在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. iOS开发之SDWebImage详解

    介绍 github地址: https://github.com/rs/SDWebImage 简介 一个异步图片下载及缓存的库 特性: 一个扩展UIImageView分类的库,支持加载网络图片并缓存图片 ...

  2. Xamarin.Android开发实践(五)

    原文:Xamarin.Android开发实践(五) 一.服务的生命周期 服务与活动一样,在它的整个生命周期中存在着一些事件,下图可以很好解释整个过程以及涉及到的方法: 在真实的使用中,Service来 ...

  3. 用C语言写一个程序,得出当前系统的整形数字长(16位,32位,64位)等,不能使用sizeof()

    #include <iostream>#include <cmath>using namespace std; int main(){ int num = -1; unsign ...

  4. MySQL server has gone away 解决方法

    应用程序(比如PHP)长时间的执行批量的MYSQL语句.执行一个SQL,但SQL语句过大或者语句中含有BLOB或者longblob字段.比如,图片数据的处理.都容易引起MySQL server has ...

  5. 2014 北京邀请赛ABDHJ题解

    A. A Matrix 点击打开链接 构造,结论是从第一行開始往下产生一条曲线,使得这条区间最长且从上到下递减, #include <cstdio> #include <cstrin ...

  6. c 中有关打印*,字符的题目集

    #include<stdio.h> //1.打印* void priStar() { printf("输入一个整数\n"); int num; scanf(" ...

  7. Web Deploy发布网站一条龙解决方案

    Web Deploy工具对于ASP.NET开发人员来说一定不陌生,没有用过也经常见到,Web Deploy发布十分方便而且在发布时会帮助用户检验发布文件的正确性.接下来介绍一下基础使用. 第一步:安装 ...

  8. Codeforces Round #316 (Div. 2A) 570A Elections

    题目:Click here #include <bits/stdc++.h> using namespace std; typedef long long ll; const int IN ...

  9. 10个值得我们关注的python博客

    大家好,还记得我当时学习python的时候,我一直努力地寻找关于python的博客,但我发现它们的数量很少.这也是我建立这个博客的原因,向大家分享我自己学到的新知识.今天我向大家推荐10个值得我们关注 ...

  10. Qt Chart 5.7.0 傻瓜安装教程

    前提 qtchart 里的README文件(注意红色标记处)(本人翻译不行.多多见谅,也可以在评论里纠正( ⊙ o ⊙ )) --------------- Qt Charts 5.7.0 ----- ...