TControlStyle.csParentBackground的作用(附Delphi里的所有例子,待续)
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 TPageControl. TWinControl 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里的所有例子,待续)的更多相关文章
- Windows窗口样式速查参考,Delphi窗口控件的风格都有它们来决定(附Delphi何时用到它们,并举例说明)good
/* 窗口样式参考列表(都是GetWindowLong的GWL_STYLE风格,都是TCreateParams.Sytle的一部分),详细列表如下:https://msdn.microsoft.com ...
- Delphi里的Windows消息(可查MSDN指定位置)
各种控件的通知消码和控制消息可由MSDN-> Platform SDK-> User Interface Services->Windows User Interface->C ...
- 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 ...
- delphi 三层架构简单例子(经测试成功)
delphi 三层架构简单例子(经测试成功) 转载 2013年12月19日 09:48:57 1100 所谓三层: (1) 客户端 (2) 服务器端 (3) 数据库 在数据访问时,使得客户端必须通过服 ...
- Delphi完成的断点续传例子 转
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- Delphi里J+开关作用类似C语言的static变量
從前筆者曾經對以下的程式產生過疑惑:{$J+}procedure TForm1.Button1Click(Sender: TObject);const VarConst: integer = 4;b ...
- WM_ERASEBKGND官方解释(翻译),以及Delphi里所有的使用情况(就是绘制窗口控件背景色,并阻止进一步传递消息)
#define WM_ERASEBKGND 0x0014 Parameters wParam A handle to the device context. // ...
- Delphi里的RTTI与反射(举例换掉FOnChange)
Delphi2010之后的RTTI做了很大休整,现在用起来很爽了哦.甚至可以获取某些类的内部私有单元,然后为其赋值!讲这个RTTI增强的,可以参考网上的多个博客内容,我列举一下:Delphi2010R ...
- 终于懂了:WM_PAINT中应该用BeginPaint与EndPaint这两个api,它们的功能正是使无效区域恢复(所以WM_PAINT里即使什么都不做,也必须写上BeginPaint与EndPaint)——Delphi里WM_PAINT消息的三个走向都做到了这一点 good
程序本来是想实现鼠标单击改变背景颜色.可是,程序运行时,为什么没有任何消息触发,背景颜色就一直不断的改变了?WM_PAINT怎么被触发的 #include <windows.h> #inc ...
随机推荐
- EasyUI - tab动态加载datagrid
addTab: function() { $("#myTabs").tabs('add', { title: 'my title', closable: true, tools: ...
- ACM第三次比赛UVA11877 The Coco-Cola Store
Once upon a time, there is a special coco-cola store. If you return three empty bottles to the sho ...
- ACM第二次比赛( C )
Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description Vanya ...
- 一天一个类--ArrayList之二
继续我的小激动--- 1.看看构造一个ArrayList 有两种方式 一个指定大小,一个不指定.我们知道他其实使用数组来实现了,数组肯定要有大小,那么他没指定大小,默认的是多少呢???追踪源码---开 ...
- Intent数据传递
(1)首先是Activity的简单跳转: 1).Activity的切换一般是通过Intent来实现的,Intent是一个Activity到达另一个Activity的引路者,它描述了起点(当前Activ ...
- UISearchBar控件
摘自:http://blog.sina.com.cn/s/blog_7b9d64af0101dfg8.html UISearchBar控件就是要为你完成搜索功能的一个专用控件.它集成了很多你意想不到的 ...
- handler.postDelayed()和timerTask
public static void scrollToListviewTop(final XListView listView) { listView.smoothScrollToPosition(0 ...
- SVN的trunk、branch、tag(二)
转——简单的对比 SVN的工作机制在某种程度上就像一颗正在生长的树: 一颗有树干和许多分支的树 分支从树干生长出来,并且细的分支从相对较粗的树干中长出 一棵树可以只有树干没有分支(但是这种情况不会持续 ...
- maven项目部署到Repository(Nexus)
目录[-] (一)下载并安装Nexus (二)配置Nexus Repository 说明: (三)在项目中配置Nexus Repository的信息 (四)发布到Nexus Repository 本文 ...
- 【SICP感应】3
级数据和符号数据
在本书的第二章学习时,有一个问题我一直很困扰,那是2.2.4举例节.因为没有华丽的输出模式书,它只能有一个对的英文字母.两三个月的这浅浅的学校前Common Lisp同样是真实的,当.了非常赞的线条, ...