Mega Code Archive

 
Categories / Delphi / Examples
 

How do i make transparent forms

You need to override the CreateParam function and there add WS_EX_TRANSPARENT to the Params.ExStyle. Set the form's canvas' Brush.Style to bsClear, as shown in this example: type TMyForm = class(TForm) procedure FormCreate(Sender: TObject); procedure CreateParams(var Params: TCreateParams); override; end; procedure TMyForm.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); // this is the important constant! Params.ExStyle:= Params.ExStyle or WS_EX_TRANSPARENT; end; Procedure TMyForm.FormCreate(Sender: TObject); begin inherited; Canvas.Brush.Style := bsClear; end;