I think the following code works, try sticking something on the form like a
button so something can be seen.

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;


Try looking up 'CreateRectRgn' and 'SetWindowRgn' in the Win32 Api help and
they will explain how it all works.  They are normally used for changing the
shape of a form.


Nahum Wild
Switch Power Systems
Christchurch
New Zealand


-----Original Message-----
From: gajo [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 10 August 1999 12:18
To: Multiple recipients of list delphi
Subject: [DUG]: Transparent forms


I want to draw custom shapes and images on my desktop (like some
screensavers do), and I figured out this would be possible only if the Form
was transparent and every other component on it normal as is. So my question
is: how can I make my form transparent or is there any other
way to draw on the screen/desktop and make that disappear after I click on a
button (for example)?

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to