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. 基于visual Studio2013解决算法导论之029二叉搜索树

     题目 二叉搜索树 解决代码及点评 #include <stdio.h> #include <malloc.h> #include <stdlib.h> ty ...

  2. THUSC2015

    这些题目在BZOJ上面有,可惜是权限题.话说BZOJ上面的题目真的挺好的,要不是我穷,早就去弄个号了! 言归正传,今年的题目难度可以由一个名人名言看出: 题目太水.--某某神犇 可是我掂量了一下,发现 ...

  3. Linux环境下编译并执行ava helloworld程序

    原文:http://blog.lupaworld.com/home-space-uid-24466-do-blog-id-2578.html 已经学会怎样在Windows下怎样编辑,编译和运行Java ...

  4. Android Cocos2d-x游戏集成友盟社会化组件分享功能

    最近在帮助开发者集成友盟社会化组件的过程中,发现游戏的集成过程遇到一些困难,而Cocos2d-x具有较好的代表性,因此整理了一篇关于Android Cocos2d-x游戏集成友盟社会化组件指南,由于本 ...

  5. POJ 2528 QAQ段树+分离

    Time Limit:1000MS    Memory Limit:65536KB    64bit IO Format:%I64d & %I64u Submitcid=58236#statu ...

  6. 关于页ASP.NET面布局

    关于页面布局,充分利用Table和分层   从接触ASP.NET到现在已经有一段时间了,起初总是嫌麻烦,想找捷径,凡是想当然,结果导致自己反而走了不少的弯路. 起初刚开始接触ASP.NET的时候,发现 ...

  7. malloc & free

    动态分配内存 #include<stdio.h> #include<stdlib.h> int compare_integers(void const *a,void cons ...

  8. m2eclipse简单使用,创建Maven项目 ,运行mvn命令(转)

    前面介绍了如何安装m2eclipse,现在,我们使用m2ecilpse导入Hello World项目. 选择菜单项File,然后选择Import,我们会看到一个Import对话框,在该对话框中选择Ge ...

  9. SmartGit 试用过期

    smartgit是见过的最好用的git客户端, 要解决其试用版过期的问题,如下: 1.定位到文件夹 Windows: %APPDATA%\syntevo\SmartGit\OS X: ~/Librar ...

  10. ajax动态加载的图标

    http://www.ajaxload.info/ 这个网站可以动态生成ajax加载样式的小图片,git格式,挺不错推荐给大家