Only applicable when Themes are enabled in applications on Windows XP. Causes the parent to draw its background into the control's background. This is useful for controls that need to show their parent's theme elements, such as aTPanel or TFrame that appears on a TPageControlTWinControl introduces a protected ParentBackground property that includes/excludes the csParentBackground control style.

------------------------------------------------------------------------------------

在Controls.pas单元里的使用:

procedure TWinControl.WMEraseBkgnd(var Message: TWMEraseBkgnd);
begin
with ThemeServices do
if ThemesEnabled and Assigned(Parent) and (csParentBackground in FControlStyle) then
begin
{ Get the parent to draw its background into the control's background. }
DrawParentBackground(Handle, Message.DC, nil, False);
end
else
begin
{ Only erase background if we're not doublebuffering or painting to memory. }
if not FDoubleBuffered or
(TMessage(Message).wParam = TMessage(Message).lParam) then
FillRect(Message.DC, ClientRect, FBrush.Handle);
end; Message.Result := ;
end; procedure TWinControl.CMInvalidate(var Message: TMessage);
var
I: Integer;
begin
if HandleAllocated then
begin
if Parent <> nil then Parent.Perform(CM_INVALIDATE, , );
if Message.WParam = then
begin
InvalidateRect(FHandle, nil, not (csOpaque in ControlStyle));
{ Invalidate child windows which use the parentbackground when themed }
if ThemeServices.ThemesEnabled then
for I := to ControlCount - do
if csParentBackground in Controls[I].ControlStyle then
Controls[I].Invalidate;
end;
end;
end; function TWinControl.GetParentBackground: Boolean;
begin
Result := csParentBackground in ControlStyle;
end; procedure TWinControl.SetParentBackground(Value: Boolean);
begin
if ParentBackground <> Value then
begin
if Value then
ControlStyle := ControlStyle + [csParentBackground]
else
ControlStyle := ControlStyle - [csParentBackground];
Invalidate;
end;
end;

问题是,D7里的ThemeServices.ThemesEnabled始终都是False,即使使用了Windows皮肤也是如此,莫非需要做什么额外的设置?

TControlStyle.csParentBackground的作用(附Delphi里的所有例子,待续)的更多相关文章

  1. Windows窗口样式速查参考,Delphi窗口控件的风格都有它们来决定(附Delphi何时用到它们,并举例说明)good

    /* 窗口样式参考列表(都是GetWindowLong的GWL_STYLE风格,都是TCreateParams.Sytle的一部分),详细列表如下:https://msdn.microsoft.com ...

  2. Delphi里的Windows消息(可查MSDN指定位置)

    各种控件的通知消码和控制消息可由MSDN-> Platform SDK-> User Interface Services->Windows User Interface->C ...

  3. Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8整合例子(附完整的请假流程例子,jbpm基础,常见问题解决)

    Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8 整合例子(附完整的请假流程例子). 1.jbpm4.4 测试环境搭建 2.Jbpm4.4+hibernat ...

  4. delphi 三层架构简单例子(经测试成功)

    delphi 三层架构简单例子(经测试成功) 转载 2013年12月19日 09:48:57 1100 所谓三层: (1) 客户端 (2) 服务器端 (3) 数据库 在数据访问时,使得客户端必须通过服 ...

  5. Delphi完成的断点续传例子 转

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...

  6. Delphi里J+开关作用类似C语言的static变量

    從前筆者曾經對以下的程式產生過疑惑:{$J+}procedure TForm1.Button1Click(Sender: TObject);const  VarConst: integer = 4;b ...

  7. WM_ERASEBKGND官方解释(翻译),以及Delphi里所有的使用情况(就是绘制窗口控件背景色,并阻止进一步传递消息)

    #define WM_ERASEBKGND                   0x0014 Parameters wParam A handle to the device context. //  ...

  8. Delphi里的RTTI与反射(举例换掉FOnChange)

    Delphi2010之后的RTTI做了很大休整,现在用起来很爽了哦.甚至可以获取某些类的内部私有单元,然后为其赋值!讲这个RTTI增强的,可以参考网上的多个博客内容,我列举一下:Delphi2010R ...

  9. 终于懂了:WM_PAINT中应该用BeginPaint与EndPaint这两个api,它们的功能正是使无效区域恢复(所以WM_PAINT里即使什么都不做,也必须写上BeginPaint与EndPaint)——Delphi里WM_PAINT消息的三个走向都做到了这一点 good

    程序本来是想实现鼠标单击改变背景颜色.可是,程序运行时,为什么没有任何消息触发,背景颜色就一直不断的改变了?WM_PAINT怎么被触发的 #include <windows.h> #inc ...

随机推荐

  1. Android自定义组合控件:UIScrollLayout(支持界面滑动及左右菜单滑动)

    一.前言: 我之前很早的时候,写过一篇<左右滑出菜单>的文章: http://blog.csdn.net/qingye_love/article/details/8776650 用的是对V ...

  2. 九度OnlineJudge之1023:EXCEL排序

    题目描述:     Excel可以对一组纪录按任意指定列排序.现请你编写程序实现类似功能.     对每个测试用例,首先输出1行“Case i:”,其中 i 是测试用例的编号(从1开始).随后在 N ...

  3. ReviewBoard安装和配置札记

    眼下部门还没有採用Pair Programming那种时时刻刻都在review代码的工作方式,代码Review多採用走查方式,即代码写完后召开一个Code Review的Meeting,集中时间和经验 ...

  4. YouTube为什么打不开?以及简便的訪问的方法/解决方式!

    在站点统计中看到好多人通过百度或者谷歌(Google)搜索引擎搜:YouTube怎么上不去,怎样不用代理server訪问YouTube,YouTube上不去的解决的方法,YouTube怎样訪问等等.事 ...

  5. Java之从控制台读入数据

    0 引言    从控制台中读取数据是一个比较常用的功能,在 JDK 5.0 以前的版本中的实现是比较复杂的,需要手工处理系统的输入流.有意思的是,从 JDK 5.0 版本开始,能从控制台中输入数据的方 ...

  6. 15-UIKit(view布局、Autoresizing)

    目录: 1. 纯代码布局 2. 在View中进行代码布局 3. Autoresizing 回到顶部 1. 纯代码布局 纯代码布局分VC下和V下 [MX1-layout-code] 在VC下覆盖view ...

  7. Qt学习之路(58): 进程间交互(QProcess.readAllStandardOutput可以读取控制台的输出)

    所谓 IO 其实不过是与其他设备之间的数据交互.在 Linux 上这个概念或许会更加清楚一些.Linux 把所有设备都看作是一种文件,因此所有的 IO 都归结到对文件的数据交互.同样,与其他进程之间也 ...

  8. AES加密时抛出java.security.InvalidKeyException: Illegal key size or def

    原文:AES加密时抛出java.security.InvalidKeyException: Illegal key size or def 使用AES加密时,当密钥大于128时,代码会抛出 java. ...

  9. JRE 和 JDK 的区别是什么?

    JRE: Java Runtime Environment JDK:Java Development Kit JRE顾名思义是java运行时环境,包含了java虚拟机,java基础类库.是使用java ...

  10. 用PowerMockito来mock私有方法(转)

    话说我们做的所谓的接口测试真的是不伦不类啊,测的是controller层,那叫接口木??!!可是老大们说写的是接口测试,那就接口吧! 自接手写这个接口测试不久,很多人,包括一个关系比较好的架构师就跟我 ...