Topic: Rounded corner
Hello Dmitry
I was testing a pied of code to add a visual effect to some components on a form.
In this case, I was trying to get rounded corners to a panel.
I used this code :
procedure RoundCornerOf(Control: TWinControl);
var R: TRect;
Rgn: HRGN;
begin
with Control do
begin
R := ClientRect;
rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, 20, 20) ;
Perform(EM_GETRECT, 0, lParam(@r)) ;
InflateRect(r, - 4, - 4) ;
Perform(EM_SETRECTNP, 0, lParam(@r)) ;
SetWindowRgn(Handle, rgn, True) ;
Invalidate;
end;
end;
begin
RoundCornerOf(Panel1);
end.
I get an error message : "unknown type : TRect".
Howewer, type TRect belongs to System Unit which is implemented.
Any idea about it ?
Thanks
Regards JB