diff --git a/docs/xml/lcl/forms.xml b/docs/xml/lcl/forms.xml index eda6658718..ee67349fab 100644 --- a/docs/xml/lcl/forms.xml +++ b/docs/xml/lcl/forms.xml @@ -6743,18 +6743,23 @@ The function variant creates a new TBitmap instance which is used as the return value. It calls the overloaded variant to get the content in the TBitmap instance. The return value must be managed by the calling routine; the instance must be explicitly freed to avoid a memory leak. The return value can -be Nil if an Exception was raised and handled in the method. +be Nil if an Exception was raised and handled in the method. This +variant is compatible with the signature used in the Delphi VCL; the overloaded +procedure leads to clearer code and avoids a potential memory leak.

For example:

procedure TForm1.Button1Click(Sender: TObject); +var + bmp: TBitmap; begin + bmp := GetFormImage; try - Image1.Picture.Assign(GetFormImage); + Image1.Picture.Assign(bmp); finally - Image1.Picture.Free; // to avoid a memory leak + bmp.Free; end; end;