unit Atlas.TestVcl; // VCL helpers for the Atlas product test programs. interface uses Vcl.Forms; // Shows Form far off screen, lets it paint, and saves what it looks like as a // PNG, so a demo window can be reviewed without anyone having to click it. procedure SaveFormImage(Form: TForm; const FileName: string); implementation uses System.SysUtils, Winapi.Windows, Vcl.Graphics, Vcl.Imaging.pngimage; procedure SaveFormImage(Form: TForm; const FileName: string); var Image: Vcl.Graphics.TBitmap; Png: TPngImage; I: Integer; begin Form.Position := poDesigned; Form.Left := -20000; Form.Top := -20000; Form.Show; try // Several rounds: layout, deferred scroll bar changes and timers all post messages. for I := 1 to 5 do begin Application.ProcessMessages; Sleep(20); end; Image := Form.GetFormImage; try Png := TPngImage.Create; try Png.Assign(Image); Png.SaveToFile(FileName); finally Png.Free; end; finally Image.Free; end; finally Form.Hide; end; end; end.