delphi实现圆角窗体[转]

2021-02-05 08:16

阅读:474

标签:procedure   sel   set   定义   RoCE   null   end   width   delete   

procedure TForm1.FormCreate(Sender: TObject);
var
hr :thandle;
begin
hr:=createroundrectrgn(1,1,width-2,height-2,5,5);
setwindowrgn(handle,hr,true);
end;

procedure TForm1.FormPaint(Sender: TObject);
var
DC: HDC;
Pen: HPen;
OldPen: HPen;
OldBrush: HBrush;
begin
DC := GetWindowDC(Handle);
Pen := CreatePen(PS_SOLID, 1, clGray);
OldPen := SelectObject(DC, Pen); //载入自定义的画笔,保存原画笔
OldBrush := SelectObject(DC, GetStockObject(NULL_BRUSH));//载入空画刷,保存原画刷
RoundRect(DC, 0, 0, Width-1, Height-1, 6, 6); //画边框
SelectObject(DC,OldBrush);//载入原画刷
SelectObject(DC,OldPen); // 载入原画笔
DeleteObject(Pen);
ReleaseDC(Handle, DC);
end;

delphi实现圆角窗体[转]

标签:procedure   sel   set   定义   RoCE   null   end   width   delete   

原文地址:https://www.cnblogs.com/blogpro/p/11446818.html


评论


亲,登录后才可以留言!