TWinControl.WMNCPaint对非客户的绘制
2024-09-14 13:42:57
混个脸熟:
procedure TWinControl.WMNCPaint(var Message: TMessage);
const
InnerStyles: array[TBevelCut] of Integer = (, BDR_SUNKENINNER, BDR_RAISEDINNER, );
OuterStyles: array[TBevelCut] of Integer = (, BDR_SUNKENOUTER, BDR_RAISEDOUTER, );
EdgeStyles: array[TBevelKind] of Integer = (, , BF_SOFT, BF_FLAT);
Ctl3DStyles: array[Boolean] of Integer = (BF_MONO, );
var
DC: HDC;
RC, RW, SaveRW: TRect;
EdgeSize: Integer;
WinStyle: Longint;
begin
{ Get window DC that is clipped to the non-client area }
if (BevelKind <> bkNone) or (BorderWidth > ) then
begin
DC := GetWindowDC(Handle);
try
Windows.GetClientRect(Handle, RC);
GetWindowRect(Handle, RW);
MapWindowPoints(, Handle, RW, );
OffsetRect(RC, -RW.Left, -RW.Top);
ExcludeClipRect(DC, RC.Left, RC.Top, RC.Right, RC.Bottom);
{ Draw borders in non-client area }
SaveRW := RW;
InflateRect(RC, BorderWidth, BorderWidth);
RW := RC;
if BevelKind <> bkNone then
begin
EdgeSize := ;
if BevelInner <> bvNone then Inc(EdgeSize, BevelWidth);
if BevelOuter <> bvNone then Inc(EdgeSize, BevelWidth);
with RW do
begin
WinStyle := GetWindowLong(Handle, GWL_STYLE);
if beLeft in BevelEdges then Dec(Left, EdgeSize);
if beTop in BevelEdges then Dec(Top, EdgeSize);
if beRight in BevelEdges then Inc(Right, EdgeSize);
if (WinStyle and WS_VSCROLL) <> then Inc(Right, GetSystemMetrics(SM_CYVSCROLL));
if beBottom in BevelEdges then Inc(Bottom, EdgeSize);
if (WinStyle and WS_HSCROLL) <> then Inc(Bottom, GetSystemMetrics(SM_CXHSCROLL));
end;
DrawEdge(DC, RW, InnerStyles[BevelInner] or OuterStyles[BevelOuter],
Byte(BevelEdges) or EdgeStyles[BevelKind] or Ctl3DStyles[Ctl3D] or BF_ADJUST);
end;
IntersectClipRect(DC, RW.Left, RW.Top, RW.Right, RW.Bottom);
RW := SaveRW;
{ Erase parts not drawn }
OffsetRect(RW, -RW.Left, -RW.Top);
Windows.FillRect(DC, RW, Brush.Handle);
finally
ReleaseDC(Handle, DC);
end;
end; inherited; // 又发现这句对TWinControl.DefaultHandler的调用 if ThemeServices.ThemesEnabled and (csNeedsBorderPaint in ControlStyle) then
ThemeServices.PaintBorder(Self, False);
end;
最新文章
- python 中的高级函数sorted()
- bzoj 3389
- loading等待载入正在加载的动画GIF图片圆形图标
- Android IOS WebRTC 音视频开发总结(五九)-- webrtc这蛋糕都怎么吃?
- Managing linux Shell Jobs
- 使用objdump objcopy查看与修改符号表
- Android使用学习之画图(Canvas,Paint)与手势感应及其应用(乒乓球小游戏)
- ORACLE SEQUENCE跳号总结
- SQL中DATENAME函数的用法
- mysql 增加时间字段
- Photoshop 基础五 橡皮擦工具
- Qt__主窗口、菜单和工具条(QMainWindow,QMenu,QToolBar)
- 【★★★★★】提高PHP代码质量的36个技巧
- 用命令让vbox的虚拟硬盘文件转换成vmware的vmdk
- Git branch 分支与合并分支
- Codeforces483B. Friends and Presents(二分+容斥原理)
- 转:C# 读取EXCEL文件的三种经典方法
- 抓老鼠 codeForce 148D - Bag of mice 概率DP
- 021.13 IO流 RandomAccessFile对象
- Hadoop生态圈-Hive的自定义函数之UDTF(User-Defined Table-Generating Functions)
热门文章
- int *p = NULL 和 *p = NULL(转载)
- tabbar动画切换
- AWVS介绍(转)
- 嵌入式环境:挂载开发板根NFS文件系统失败
- TortoiseSVN (一) - 疑难操作
- 使用ant的war任务打包j2ee web项目
- 修改linux文件权限命令:chmod 【转载】
- Jsp分页实例---假分页
- vi编辑器使用介绍
- 在 Perl看来, 字符串只有两种形式. 一种是octets, 即8位序列, 也就是我们通常说的字节数组. 另一种utf8编码的字符串, perl管它叫string. 也就是说: Perl只熟悉两种编