正常来说可以用canvas设置brush.bitmap,然后fillrect就行了,你说的这几个就panel没有
canvas,所以要先为它加上canvas再画
var
Form1: TForm1;
bmp:tbitmap;
Mcanvas:TCanvas;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
with PageControl1 do begin
Canvas.Brush.Bitmap:=bmp;
Canvas.FillRect(PageControl1.ClientRect);
end;
with TabControl1 do begin
Canvas.Brush.bitmap:=bmp;
Canvas.FillRect(ClientRect);
end;
Mcanvas.Brush.Bitmap:=bmp;
Mcanvas.FillRect(Panel1.ClientRect);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
bmp:=TBitmap.Create;
bmp.LoadFromFile('c:/1.bmp');
Mcanvas:=TCanvas.Create;//为panel1加canvas
Mcanvas.Handle:=GetDC(Panel1.Handle);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Mcanvas.Free;
bmp.Free;
end;
end.