圆角Panel
来源:互联网 发布:深交所网络投票系统 编辑:程序博客网 时间:2024/05/23 16:45
How to show a Tpanel with roundrect shape
Title: How to show a Tpanel with roundrect shape
procedure TForm1.FormCreate(Sender: TObject);
const
bgcolor = $00FFDDEE;
linecolor = $00554366;
var
img: array of TImage;
reg: hrgn;
i: Integer;
begin
for i := 0 to ComponentCount - 1 do
begin
if Components[i].ClassName = 'TPanel' then
begin
setlength(img, Length(img) + 1);
img[i] := TImage.Create(Self);
img[i].Width := (Components[i] as TPanel).Width;
img[i].Height := (Components[i] as TPanel).Height;
img[i].Parent := (Components[i] as TPanel);
img[i].Canvas.Brush.Color := bgcolor;
img[i].Canvas.pen.Color := bgcolor;
img[i].Canvas.Rectangle(0,0,img[i].Width, img[i].Height);
img[i].Canvas.pen.Color := linecolor;
img[i].Canvas.RoundRect(0,0,img[i].Width - 1,img[i].Height - 1,20,20);
reg := CreateRoundRectRgn(0,0,(Components[i] as TPanel).Width,
(Components[i] as TPanel).Height, 20,20);
setwindowrgn((Components[i] as TPanel).Handle, reg, True);
deleteobject(reg);
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
const
bgcolor = $00FFDDEE;
linecolor = $00554366;
var
img: array of TImage;
reg: hrgn;
i: Integer;
begin
for i := 0 to ComponentCount - 1 do
begin
if Components[i].ClassName = 'TPanel' then
begin
setlength(img, Length(img) + 1);
img[i] := TImage.Create(Self);
img[i].Width := (Components[i] as TPanel).Width;
img[i].Height := (Components[i] as TPanel).Height;
img[i].Parent := (Components[i] as TPanel);
img[i].Canvas.Brush.Color := bgcolor;
img[i].Canvas.pen.Color := bgcolor;
img[i].Canvas.Rectangle(0,0,img[i].Width, img[i].Height);
img[i].Canvas.pen.Color := linecolor;
img[i].Canvas.RoundRect(0,0,img[i].Width - 1,img[i].Height - 1,20,20);
reg := CreateRoundRectRgn(0,0,(Components[i] as TPanel).Width,
(Components[i] as TPanel).Height, 20,20);
setwindowrgn((Components[i] as TPanel).Handle, reg, True);
deleteobject(reg);
end;
end;
end;
- 圆角Panel
- c# winForm 圆角Panel
- c# winForm 圆角Panel
- panel
- panel
- 简单的Delphi控件-圆角Panel
- panel添加panel
- C# 圆角Panel - (参考基础上原创)
- 【转】用户自定义控件(含源代码)-圆角Panel
- qq panel
- 容器Panel
- panel用法
- Ext.Panel
- panel mouseDrag
- ext:panel
- ext panel
- ext panel
- QQ panel
- 关于PHP可变参数与缺省参数
- TabActivity,TabHost,
- 同时运行两个动作 CCSpawn cocos2d
- PHP 求最大公约数与最小公倍数
- DhtmlxTree在IE8下漂移问题
- 圆角Panel
- 杭电1251 字典树典型应用
- Linux 开机启动[root@localhost]变成bash#解决方法
- Android NFS 开发配置
- 马云:经历就是一种成功
- 统计一个无序数组中出现次数最多的元素
- STM32 CAN过滤器的学习心得
- 2011级华中科技大学软件学院软件工程硕士培养方案(附课表)
- 把java对象转换为json串的类