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实现圆角窗体
最新推荐文章于 2020-05-06 10:48:49 发布