TFormOnPaint (Delphi)
Description
The following code loads a background bitmap onto the canvas of the main form in the OnPaint event handler.
Code
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);
begin
TheGraphic := TBitmap.Create; { Create the bitmap object. }
TheGraphic.LoadFromFile('bigf.bmp'); { Load the bitmap from a file. }
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
(TheGraphic as TObject).Free;
end;
Uses
- Vcl.Forms.TCustomForm.OnPaint ( fr | de | ja )