在controls.pas单元里只有判断,没有赋值,所以一直不是很明白。于是在stdCtrls.pas里找了几个例子,直观加深一下印象:

constructor TCustomLabel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle + [csReplicatable];
Width := ;
Height := ;
FAutoSize := True;
FShowAccelChar := True;
{ The "default" value for the Transparent property depends on
if you have Themes available and enabled or not. If you have
ever explicitly set it, that will override the default value. }
if ThemeServices.ThemesEnabled then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque]; // 默认走这里
end; function TCustomLabel.GetTransparent: Boolean;
begin
Result := not (csOpaque in ControlStyle);
end; procedure TCustomLabel.SetTransparent(Value: Boolean);
begin
if Transparent <> Value then
begin
if Value then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque];
Invalidate;
end;
FTransparentSet := True;
end; constructor TCustomListBox.Create(AOwner: TComponent);
const
ListBoxStyle = [csSetCaption, csDoubleClicks, csOpaque];
begin
inherited Create(AOwner);
if NewStyleControls then
ControlStyle := ListBoxStyle else
ControlStyle := ListBoxStyle + [csFramed];
Width := ;
Height := ;
TabStop := True;
ParentColor := False;
FAutoComplete := True;
FItems := TListBoxStrings.Create;
TListBoxStrings(FItems).ListBox := Self;
FCanvas := TControlCanvas.Create;
TControlCanvas(FCanvas).Control := Self;
FItemHeight := ;
FBorderStyle := bsSingle;
FExtendedSelect := True;
FOldCount := -;
end;

再在ExtCtrls.pas里找几个素材:

procedure TImage.PictureChanged(Sender: TObject);
var
G: TGraphic;
D : TRect;
begin
if AutoSize and (Picture.Width > ) and (Picture.Height > ) then
SetBounds(Left, Top, Picture.Width, Picture.Height);
G := Picture.Graphic;
if G <> nil then
begin
if not ((G is TMetaFile) or (G is TIcon)) then
G.Transparent := FTransparent;
D := DestRect;
if (not G.Transparent) and (D.Left <= ) and (D.Top <= ) and
(D.Right >= Width) and (D.Bottom >= Height) then
ControlStyle := ControlStyle + [csOpaque]
else // picture might not cover entire clientrect
ControlStyle := ControlStyle - [csOpaque];
if DoPaletteChange and FDrawing then Update;
end
else ControlStyle := ControlStyle - [csOpaque];
if not FDrawing then Invalidate;
end; constructor TCustomPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents,
csSetCaption, csOpaque, csDoubleClicks, csReplicatable];
{ When themes are on in an application default to making
TCustomPanel's paint with their ParentBackground }
if ThemeServices.ThemesEnabled then
ControlStyle := ControlStyle + [csParentBackground] - [csOpaque];
Width := ;
Height := ;
FAlignment := taCenter;
BevelOuter := bvRaised;
BevelWidth := ;
FBorderStyle := bsNone;
Color := clBtnFace;
FFullRepaint := True;
UseDockManager := True;
end; procedure TCustomPanel.SetParentBackground(Value: Boolean);
begin
{ TCustomPanel needs to not have csOpaque when painting
with the ParentBackground in Themed applications }
if Value then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque];
FParentBackgroundSet := True;
inherited;
end;

什么是透明(和Windows主题有关系),研究TLable和TPanel是两个好例子的更多相关文章

  1. Java: 在不同windows主题下,JFrame窗口设置最佳高度的解决方案

    //设置窗口的大小,无论使用怎样的windows主题,都能灵活的应对,显示合适的窗口大小,一定要在JFrame.setVisible(true)之前调用, //替代传统的frame.setSize(w ...

  2. 和S5933比较起来,开发PLX9054比较不幸,可能是第一次开发PCI的缘故吧。因为,很多PCI的例子都是对S5933,就连微软出版的《Programming the Microsoft Windows Driver Model》都提供了一个完整的S5933的例子。 在这篇有关DDK的开发论文里。

    和S5933比较起来,开发PLX9054比较不幸,可能是第一次开发PCI的缘故吧.因为,很多PCI的例子都是对S5933,就连微软出版的<Programming the Microsoft Wi ...

  3. python实现城市气候与海洋的关系研究

    城市气候与海洋的关系研究 关注公众号"轻松学编程"了解更多. 以下命令都是在浏览器中输入. cmd命令窗口输入:jupyter notebook 后打开浏览器输入网址http:// ...

  4. 【转】Windows 窗口层次关系

    原文链接:undefined! 相信在Windows 下面编程的很多兄弟们都不是很清楚Windows 中窗口的层次关系是怎么样的,这个东西很久已经研究过一下,后来又忘记了,今天又一次遇到了这个问题,所 ...

  5. Drupal如何解析主题继承关系?

    Drupal中,主题是可以继承的,或者说是扩展.例如,要创建一个新的名为custom的主题,该主题与名为default的主题只有某些细小的差别.这个时候,不需要复制一份default到custom,可 ...

  6. SQLdeveloper换成windows主题后不显示的情况

    这几天因为换电脑需要重新安装数据库, 因为换成了64位系统, 原先的oracle数据库也换成了64位, 但是plsql还是要用32位的, 经过深思熟虑也没装, 请教了一个同学改用oracle自带的sq ...

  7. 一个windows主题网站-

    地址 地址 说明 选择适合自己的,下载,双击安装,就可使用了

  8. NLTK学习笔记(八):文法--词关系研究的工具

    [TOC] 对于一门语言来说,一句话有无限可能.问题是我们只能通过有限的程序来分析结构和含义.尝试将"语言"理解为:仅仅是所有合乎文法的句子的大集合.在这个思路的基础上,类似于 w ...

  9. oauth2-server-php for windows 的那些坑 (研究中...)

    oauth2-server-php for windows 的那些坑 在windwos 环境下,使用vs2017 for php 工具进行调试时,总是搞不出来, 于是分析了一下原因, 首先,oauth ...

随机推荐

  1. SkipFish

    https://zmap.io/ http://code.google.com/p/skipfish/wiki/SkipfishDoc#How_to_run_the_scanner?

  2. AutoCAD 2014简体中文版官方正式版x86 x64下载,带注册机,永久免费使用

    注册机使用说明:会有部分杀毒软件报病毒,请无视.操作步骤:1.安装Autodesk AutoCAD 20142.使用以下序列号666-69696969安装.3.产品密码为001F14.安装完成后,启动 ...

  3. struts ModelDriven

    在表单提交的时候传值是这样,name=admin.username name=admin.password,然后在action中定义属性admin生成get和set 也可以实现ModelDriven这 ...

  4. 链接分析算法之:主题敏感PageRank

    链接分析算法之:主题敏感PageRank     前面的讨论提到.PageRank忽略了主题相关性,导致结果的相关性和主题性降低,对于不同的用户,甚至有很大的差别.例如,当搜索“苹果”时,一个数码爱好 ...

  5. JavaEE Tutorials (4) - 企业bean入门

    4.1创建企业bean52 4.1.1编写企业bean类53 4.1.2创建converter Web客户端53 4.1.3运行converter示例544.2修改Java EE应用55 4.2.1修 ...

  6. BZOJ 1613: [Usaco2007 Jan]Running贝茜的晨练计划

    题目 1613: [Usaco2007 Jan]Running贝茜的晨练计划 Time Limit: 5 Sec  Memory Limit: 64 MB Description 奶牛们打算通过锻炼来 ...

  7. Objective-C 类,实例成员,静态变量,对象方法,类方法(静态方法),对象,

    Objective-C 类,实例成员,静态变量,对象方法,类方法(静态方法),对象, 一.类 在ios中,类的声明和实现时分离的,也就是说不能写在同一个文件中,声明放在 .h文件中,实现放在 .m 文 ...

  8. HDU 4642 (13.08.25)

    Fliping game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tot ...

  9. Python模拟登陆

    模拟人人登陆 #encoding=utf-8 import urllib2 import urllib import cookielib def renrenBrower(url,user,passw ...

  10. 【转】解决Gradle DSL method not found: ‘android()’

    [转]解决Gradle DSL method not found: ‘android()’ 最近导入as的项目出了这样的问题 这个问题困扰了我很长时间,好吧,搜了半天全都是runProguard的,最 ...