什么是透明(和Windows主题有关系),研究TLable和TPanel是两个好例子
在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是两个好例子的更多相关文章
- Java: 在不同windows主题下,JFrame窗口设置最佳高度的解决方案
//设置窗口的大小,无论使用怎样的windows主题,都能灵活的应对,显示合适的窗口大小,一定要在JFrame.setVisible(true)之前调用, //替代传统的frame.setSize(w ...
- 和S5933比较起来,开发PLX9054比较不幸,可能是第一次开发PCI的缘故吧。因为,很多PCI的例子都是对S5933,就连微软出版的《Programming the Microsoft Windows Driver Model》都提供了一个完整的S5933的例子。 在这篇有关DDK的开发论文里。
和S5933比较起来,开发PLX9054比较不幸,可能是第一次开发PCI的缘故吧.因为,很多PCI的例子都是对S5933,就连微软出版的<Programming the Microsoft Wi ...
- python实现城市气候与海洋的关系研究
城市气候与海洋的关系研究 关注公众号"轻松学编程"了解更多. 以下命令都是在浏览器中输入. cmd命令窗口输入:jupyter notebook 后打开浏览器输入网址http:// ...
- 【转】Windows 窗口层次关系
原文链接:undefined! 相信在Windows 下面编程的很多兄弟们都不是很清楚Windows 中窗口的层次关系是怎么样的,这个东西很久已经研究过一下,后来又忘记了,今天又一次遇到了这个问题,所 ...
- Drupal如何解析主题继承关系?
Drupal中,主题是可以继承的,或者说是扩展.例如,要创建一个新的名为custom的主题,该主题与名为default的主题只有某些细小的差别.这个时候,不需要复制一份default到custom,可 ...
- SQLdeveloper换成windows主题后不显示的情况
这几天因为换电脑需要重新安装数据库, 因为换成了64位系统, 原先的oracle数据库也换成了64位, 但是plsql还是要用32位的, 经过深思熟虑也没装, 请教了一个同学改用oracle自带的sq ...
- 一个windows主题网站-
地址 地址 说明 选择适合自己的,下载,双击安装,就可使用了
- NLTK学习笔记(八):文法--词关系研究的工具
[TOC] 对于一门语言来说,一句话有无限可能.问题是我们只能通过有限的程序来分析结构和含义.尝试将"语言"理解为:仅仅是所有合乎文法的句子的大集合.在这个思路的基础上,类似于 w ...
- oauth2-server-php for windows 的那些坑 (研究中...)
oauth2-server-php for windows 的那些坑 在windwos 环境下,使用vs2017 for php 工具进行调试时,总是搞不出来, 于是分析了一下原因, 首先,oauth ...
随机推荐
- python collections.Counter笔记
Counter是dict的子类,所以它其实也是字典.只不过它的键对应的值都是计数,值可以是任意整数.下面是四种创建Counter实例的例子: >>> c = Counter() # ...
- HLS 协议
HTML 5 视频直播一站式扫盲 本文来自于腾讯bugly开发者社区,原文地址:http://bugly.qq.com/bbs/forum.php?mod=viewthread&tid=1 ...
- poj 2752 Seek the Name, Seek the Fame(KMP需转换下思想)
Seek the Name, Seek the Fame Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10204 Ac ...
- error: property's synthesized getter follows Cocoa naming convention for returning 'owned' objects
出现这样的情况,主要是属性名中包括 keyword. You can solve this by: Renaming that property: @property (strong, nonato ...
- MiddleGenIDE工具的使用
1. MiddleGenIDE工具 1) 先在网上下载MiddleGenIDE工具.能够參考这里 http://blog.csdn.net/wangcunhuazi/articl ...
- 小猪猪逆袭成博士之C++基础篇(二) 常量、处理类型、自定义头文件
小猪猪逆袭成博士之C++基础篇(二) const .auto. decltype 上一章我们介绍了一些常用的类型和常见的问题,下面再介绍一些学习的时候不是特别常用但是在实际工程中很有用的一些东西. 一 ...
- 【centos6 , 6】linux 查看帮助文档:
1. 使用 命令 -h 或 命令 --help , 例: ls -h 2. man命令 : man 命令 例:man ls 3.info命令: ...
- 4.I/O复用以及基于I/O复用的回射客户端/服务器
I/O复用:当一个或多个I/O条件满足时,我们就被通知到,这种能力被称为I/O复用. 1.I/O复用的相关系统调用 posix的实现提供了select.poll.epoll两类系统调用以及相关的函数来 ...
- bootstrap base css 基本css
Headings All HTML headings, <h1> through <h6> are available. h1. Heading 1 h2. Heading 2 ...
- Net::SSH::Perl 模块
<pre name="code" class="python">Net::SSH::Perl - Perl client Interface to ...