给你个例子(Delphi的帮助里自己带的)
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;
TPanel,TPageControl:使用他们的(xx as TWinControl).Brush即可,可以不用
FillRect(Rect(0,0,100,100))去绘制,他们自己回去绘制。