[Lazarus] TForm.GetFormImage is broken?

Giuliano Colla giuliano.colla at fastwebnet.it
Tue Dec 27 22:31:43 CET 2016


Il 27/12/2016 17:49, Juha Manninen via Lazarus ha scritto:

> Somebody with good knowledge of the graphics code should fix it. I 
> remember I tried over 2 years ago but failed.
>

Just adding a line to GetFormImage does the trick:
> function TForm1.GetFormImage: TBitmap;
> var
>   ARect: TRect;
> begin
>   Result := TBitmap.Create;
>   try
>     Result.Width := ClientWidth;
>     Result.Height := ClientHeight;
>     LCLIntf.GetWindowRect(Handle, ARect);
>     with GetClientOrigin do
>       PaintTo(Result.Canvas, ARect.Left - X, ARect.Top - Y);
>   except
>     Result.Free;
>     raise;
>   end;
>   Result.Canvas.Changed; <--- This line added
> end; 

Giuliano



More information about the Lazarus mailing list