PerformEraseBackground 擦除背景(ThemeServices)

PerformEraseBackground 擦除背景的简单方法(外带ThemeServices例子) 在查这个函数的时候,顺便看到了有趣的代码。
怎么使用 Themes 。 unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ImgList, ExtCtrls;
type
TForm2 = class(TForm)
ImageList1: TImageList;
Panel1: TPanel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
TVSPanel = class(TCustomPanel)
private
protected
procedure Paint; override;
public
end;
var
Form2: TForm2;
implementation
uses Themes,UxTheme;
{$R *.dfm}
{ TVSPanel }
procedure TVSPanel.Paint;
var
Details: TThemedElementDetails;
begin
inherited;
if ThemeServices.ThemesEnabled then
begin
Details := ThemeServices.GetElementDetails(tbPushButtonHot); {这里画个按钮处于 Hot 状态下的样子}
PerformEraseBackground(Self, Canvas.Handle); {擦除画按钮时的背景}
ThemeServices.DrawElement(Canvas.Handle, Details, ClientRect);
ThemeServices.DrawText(Canvas.Handle, Details, Caption, ClientRect,
DT_EXPANDTABS or DT_VCENTER or DT_CENTER or DT_SINGLELINE, );
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
var
APanel: TVSPanel;
begin
APanel := TVSPanel.Create(Application);
APanel.Left := ;
APanel.Top := ;
APanel.Width := ;
APanel.Height := ;
APanel.Caption := '具有 Button 风格的 Panel';
APanel.Parent := Self;
end;
PerformEraseBackground 擦除背景(ThemeServices)的更多相关文章
- 具有 Button 风格的 Panel(覆盖TCustomPanel的Paint函数,用到了ThemeServices)
unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- 解决Winform应用程序中窗体背景闪烁的问题
本文转载:https://my.oschina.net/Tsybius2014/blog/659742 我的操作系统是Win7,使用的VS版本是VS2012,文中的代码都是C#代码. 这几天遇到一个问 ...
- WM_ERASEBKGND官方解释(翻译),以及Delphi里所有的使用情况(就是绘制窗口控件背景色,并阻止进一步传递消息)
#define WM_ERASEBKGND 0x0014 Parameters wParam A handle to the device context. // ...
- 具有 Button 风格的 Panel
unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- Delphi 完全时尚手册之 Visual Style 篇 (界面不错) 转自http://blog.csdn.net/iseekcode/article/details/4733229
这里先说说两个概念:Theme(主题)和 Visual Style .Theme 最早出现在 Microsoft Plus! for Windows 95 中,是 Windows 中 Wallpape ...
- Delphi 完全时尚手册之 Visual Style 篇
这里先说说两个概念:Theme(主题)和 Visual Style .Theme 最早出现在 Microsoft Plus! for Windows 95 中,是 Windows 中 Wallpape ...
- TForm的显示过程
新建一个空窗体项目,然后运行,此时首先运行: procedure TApplication.Run; begin FRunning := True; try AddExitProc(DoneAppli ...
- 一行代码设置TForm颜色的前世今生(属性赋值引起函数调用,然后发消息实现改变显示效果),TForm的初始颜色在dfm中设置了clBtnFace色
来自万一的帖子:http://www.cnblogs.com/del/archive/2008/04/27/1173658.html的确做到了一行代码设置TForm控件的颜色(一点感想:Delphi程 ...
- 研究一下TForm.WMPaint过程(也得研究WM_ERASEBKGND)——TForm虽然继承自TWinControl,但是自行模仿了TCustomControl的全部行为,一共三种自绘的覆盖方法,比TCustomControl还多一种
先擦除背景: procedure TCustomForm.WMEraseBkgnd(var Message: TWMEraseBkgnd); begin if not IsIconic(Handle) ...
随机推荐
- Nginx配置之location模块和proxy模块
1.location指令的用法介绍 Location主要用来匹配url,如:http://www.beyond.com/nice,在这里对于location来说www.beyond.com是域名,/n ...
- XML中DTD,XSD的区别与应用
XML我们并不陌生,在企业级应用中有很广的用途.具体就不再说,下面介绍一下DTD,XSD的区别并以XSD为例看spring中定义与使用.1.DTD(Documnet Type Definition)D ...
- Gym - 101806Q:QueryreuQ(回文树)
A string is palindrome, if the string reads the same backward and forward. For example, strings like ...
- 田螺便利店——联想笔记本进入不了BIOS的解决方法
当计算机遇到问题时,很多情况下需要进入BIOS进行解决.但很多新出的联想笔记本电脑在开机时,无论怎么疯狂的按F2,Fn+F2,F12或者Del,都无法进入BIOS,十分气人. 这种现象出现 ...
- currentStyle&getComputedStyle获取属性
方法如下: function getStyle(obj,attr){ if(obj.currentStyle){ return obj.currentStyle[attr]; // IE 中的方法 } ...
- Redis 当成数据库在使用和可靠的分布式锁,Redlock 真的可行么?
怎样做可靠的分布式锁,Redlock 真的可行么? https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html ...
- HDU1272小希的迷宫–并查集
上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走.但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了 ...
- windows server 2008 R2无法共享文件夹,无法启用网络发现。
问题描述:在局域网内两台window server 2008 R2服务器上设置共享文件夹,如要再网络中可以看到文件夹,需要开启“网络发现” 但是即使打开了“网络发现”,当重新打开“高级共享设置”的时候 ...
- java gaoji 算法
import java.util.Scanner; public class Main{ public static int[] Test(int[] a){ int [] ...
- css与html 与js的基础语法
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sample_2-23456.a ...