{
OnPaint example
The following code loads a background bitmap onto the Canvas of the main form in the OnPaint event handler.  In Unit 1, add a private member to TForm1 of type TBitmap named TheGraphic.
}
unit Unit1;
interface
uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, Dialogs;
type
  TForm1 = class(TForm)
    procedure FormPaint(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    TheGraphic: TBitmap; { Add this declaration for the graphic}
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.DFM}
On Cross-platform:
procedure TForm1.FormPaint(Sender: TObject); { OnPaint event handler}
begin
  Form1.Canvas.Draw(0, 0, TheGraphic); { Draw the graphic on the Canvas }
end;
procedure TForm1.FormCreate(Sender: TObject); { OnCreate event handler }
begin
  TheGraphic := TBitmap.Create; { Create the bitmap object }
  TheGraphic.LoadFromFile('C:\APP\BKGRND.BMPBKGRND.png'); { Load the bitmap from a file}
end;
end.
 
