Delphi 使控件变成圆角的方法


本文整理自网络,侵删。

 
procedure  RoundControl(Control: TWinControl; arc1, arc2: Integer);
var
  R: TRect;
  Rgn: HRGN;
begin
  with Control do
  begin
    R := Control.ClientRect;
    Rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, arc1, arc2);
    Perform(EM_GETRECT, 0, lParam(@R));
    InflateRect(R, -5, -5);
    Perform(EM_SETRECTNP, 0, lParam(@R));
    SetWindowRgn(Control.Handle, Rgn, True);
    Invalidate;
  end;
end;

相关阅读 >>

Delphi repeat until 运用

python4Delphi 示例应用程序在 Delphi 应用程序中运行简单的 python 脚本

Delphixe 如何调用stringtojstring

Delphi memo1 统计行 列

Delphi tlog 日志

Delphi vclzip压缩文件夹

Delphi 静态调用dll和动态调用dll优缺点

Delphi hook 指定程序窗体和控件的 wndproc

Delphi sysutils.strcat

Delphi10及以上版本安装activex控件

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...