how to put controls in transparent window lazarus / 39-Graphics ---------------------------------------------------------------------- Ericktux · 2019-03-07 07:36 Hello friends, first of all thanks for your support. I just found an example transparent window in the forum. here the link: http://forum.lazarus.freepascal.org/index.php?topic=35561.0 the example is "CustomShapedForm.zip" from the friend getmem, thank you very much for sharing, it works perfect.  my question is how to put controls (labels, edit, panels, buttons, etc.) on top of the image?    when I try everything disappears and only shows the transparent image. Thank you for your answers. this is the original code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit uMain; {$mode objfpc}{$H+} interface uses  Windows, JwaWindows, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,  ExtCtrls, Menus, ComCtrls; type   { TfMain }   TfMain = class(TForm)    im: TImage;    miClose: TMenuItem;    pm: TPopupMenu;    procedure FormShow(Sender: TObject);    procedure imMouseDown(Sender: TObject; {%H-}Button: TMouseButton;      {%H-}Shift: TShiftState; X, Y: Integer);    procedure imMouseMove(Sender: TObject; {%H-}Shift: TShiftState; X, Y: Integer);    procedure imMouseUp(Sender: TObject; {%H-}Button: TMouseButton;    {%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);    procedure miCloseClick(Sender: TObject);  private    DX, DY: Integer;    MoveForm: Boolean;    procedure MakeTransparentWindow;    { private declarations }  public    { public declarations }  end; var  fMain: TfMain; implementation {$R *.lfm} { TfMain } procedure TfMain.FormShow(Sender: TObject);begin  MakeTransparentWindow;end; procedure TfMain.MakeTransparentWindow;var  BlendFunction: TBlendFunction;  Size: TSize;  P: TPoint;  ExStyle: DWORD;begin  ExStyle := GetWindowLongA(Handle, GWL_EXSTYLE);  if (ExStyle and WS_EX_LAYERED = 0) then    SetWindowLong(Handle, GWL_EXSTYLE, ExStyle or WS_EX_LAYERED);  ClientWidth := im.picture.Bitmap.Width;  ClientHeight := im.picture.Bitmap.Height;  P.x := 0;  P.y := 0;  Size.cx := im.picture.Bitmap.Width;  Size.cy := im.picture.Bitmap.Height;  BlendFunction.BlendOp := AC_SRC_OVER;  BlendFunction.BlendFlags := 0;  BlendFunction.SourceConstantAlpha := 255;  BlendFunction.AlphaFormat := AC_SRC_ALPHA;  UpdateLayeredWindow(Handle, 0, nil, @Size, im.picture.Bitmap.Canvas.Handle, @P, 0, @BlendFunction, ULW_ALPHA);end; procedure TfMain.imMouseDown(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);begin  DX := X;  DY := Y;  MoveForm := True;end; procedure TfMain.imMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin if not MoveForm then   Exit; if (ssLeft in Shift) then begin   fMain.Left := fMain.Left + (X - DX);   fMain.Top := fMain.Top + (Y - DY);  end;end; procedure TfMain.imMouseUp(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);begin  MoveForm := False;end; procedure TfMain.miCloseClick(Sender: TObject);begin  Close;end; end. ---------------------------------------------------------------------- Ericktux · 2019-03-09 04:59 please if someone can help me ---------------------------------------------------------------------- balazsszekely · 2019-03-09 05:13 Hard to achieve what you're requested in a cross-platform way. It's doable on windows though. ---------------------------------------------------------------------- Ericktux · 2019-03-09 05:23 hello my friend getmem, thanks for your comment, I just need for windows. ---------------------------------------------------------------------- balazsszekely · 2019-03-09 05:25 Here you go... PS: I must warn you the attachment contains graphic violence. ---------------------------------------------------------------------- Ericktux · 2019-03-09 05:41 jajaajaja  thank you very much friend, it works perfect. a query, you should always have the background gray ? ---------------------------------------------------------------------- balazsszekely · 2019-03-09 05:48 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i CreateRegion(const AIm: TImage; const AMaskColor: TColor; out ARegion: HRGN);AMaskColor must match the backgroundcolor. It can be gray or any other color. ---------------------------------------------------------------------- Ericktux · 2019-03-09 22:06 ok my friend, thank you very much for your help.