TCustomFormCanvas (Delphi)
Description
The following code loads a bitmap from a file and assigns it to the Brush of the Canvas of Form1.
Code
var
Bitmap: TBitmap;
procedure TForm1.Button1Click(Sender: TObject);
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile('bm1.BMP');
Form1.Canvas.Brush.Bitmap := Bitmap;
Form1.Canvas.FillRect(Rect(0,0,100,100));
finally
Form1.Canvas.Brush.Bitmap := nil;
Bitmap.Free;
end;
end;
Uses
- Vcl.Forms.TCustomForm.Canvas ( fr | de | ja )
- Vcl.Graphics.TCanvas.Brush ( fr | de | ja )
- Vcl.Graphics.TBrush.Bitmap ( fr | de | ja )
- Vcl.Graphics.TCanvas.FillRect ( fr | de | ja )