procedure ArredondarComponente(Componente: TWinControl; const Radius: SmallInt);
var
R : TRect;
Rgn : HRGN;
begin
with Componente do
begin
R := ClientRect;
Rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, Radius, Radius);
Perform(EM_GETRECT, 0, lParam(@R));
InflateRect(R, -5, -5);
Perform(EM_SETRECTNP, 0, lParam(@R));
SetWindowRgn(Handle, Rgn, True);
Invalidate;
end;
end;
procedure TfrmPrincipal.Button1Click(Sender: TObject);
begin
ArredondarComponente(Edit1,10);
end;
Nenhum comentário:
Postar um comentário