var
Form1: TForm1;
region, temp : HRGN;
hdc_ : HDC;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var a, rez:integer;
x,y:integer;
begin
Canvas.Brush.Color := clBlack;
hdc_ := canvas.Handle;
region := CreateRectRgn(0,0,Width,Height);
SelectObject(hdc_ ,region);
x := 4;
y := 23;
for a:=0
to Self.ControlCount-1
do
begin
temp := CreateRectRgn(Controls[a].BoundsRect.Left +x,Controls[a].BoundsRect.Top+y,Controls[a].BoundsRect.Right+x,Controls[a].BoundsRect.Bottom+y);
rez := CombineRgn(region, region,temp ,RGN_diff );
end;
// SelectObject(hdc_ ,region);
temp := CreateRectRgn(0,0,width,Height);
rez := CombineRgn(region, region,temp ,RGN_Xor );
// InvertRgn(hdc_ ,region);
SetWindowRgn(
handle,region,true);
end;