A brush's Bitmap property lets you specify a bitmap image for the brush to use as a pattern for filling shapes and other areas.
The following example loads a bitmap from a file and assigns it to the Brush of the Canvas of Form1:
var Bitmap: TBitmap; begin Bitmap := TBitmap.Create; try Bitmap.LoadFromFile('MyBitmap.bmp'); Form1.Canvas.Brush.Bitmap := Bitmap; Form1.Canvas.FillRect(Rect(0,0,100,100)); finally Form1.Canvas.Brush.Bitmap := nil; Bitmap.Free; end; end;
BrushBmp->LoadFromFile("MyBitmap.bmp"); Form1->Canvas->Brush->Bitmap = BrushBmp; Form1->Canvas->FillRect(Rect(0,0,100,100));
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|