Making a transparent form

{Add a button to a form and try this:}

procedure TForm1.FormCreate(Sender: TObject);

var

FullRgn, ClientRgn, ButtonRgn: THandle;

Margin, X, Y: Integer;

begin

Margin := (Width - ClientWidth) div 2;

FullRgn := CreateRectRgn(0, 0, Width, Height);

X := Margin;

Y := Height - ClientHeight - Margin;

ClientRgn := CreateRectRgn

(X, Y, X + ClientWidth, Y + ClientHeight);

CombineRgn(FullRgn, FullRgn, ClientRgn, RGN_DIFF);

X := X + Button1.Left;

Y := Y + Button1.Top;

ButtonRgn := CreateRectRgn

(X, Y, X + Button1.Width, Y + Button1.Height);

CombineRgn(FullRgn, FullRgn, ButtonRgn, RGN_OR);

SetWindowRgn(Handle, FullRgn, True);

end;