procedure TForm1.Button1Click(Sender: TObject);
var
frmRegion, tempRegion: HRGN;
i: Integer;
Arect: TRect;
Begin
frmRegion := 0;
for I:= 0 to ControlCount - 1 Do
begin
aRect := Controls[i].BoundsRect;
OffsetRect( aRect, clientorigin.x - left, clientorigin.y - top );
tempRegion := CreateRectRgnIndirect( aRect );
if frmRegion = 0 Then
frm Region := tempRegion
else
begin
CombineRgn( frmRegion, frmRegion, tempRegion, RGN_OR );
DeleteObject( tempRegion );
end;
end;
CombineRgn( frmRegion, frmRegion, tempRegion, RGN_OR );
SetWindowRgn( handle, frmRegion, True );
DeleteObject( tempRegion );
end;