1、定义本窗体的全局变量 bitmap:TBitmap; 2、LOAD图片 procedure TForm1.FormCreate(Sender: TObject); begin bitmap:=TBitmap.Create; bitmap.LoadFromFile('c:\a.bmp'); end; 3、显示 procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin if state <>[] then begin end else begin stringgrid1.Canvas.Brush.Style:=bsclear; stringgrid1.canvas.copyrect(rect, bitmap.canvas, rect); //bmp为所要加载的背景 stringgrid1.canvas.textrect(rect, rect.left+2 , rect.top+2, stringgrid1.cells[acol, arow]); end; end ;
2、LOAD图片
procedure TForm1.FormCreate(Sender: TObject);
begin
bitmap:=TBitmap.Create;
bitmap.LoadFromFile('c:\a.bmp');
end;
3、显示
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
if state <>[] then
begin
end
else
begin
stringgrid1.Canvas.Brush.Style:=bsclear;
stringgrid1.canvas.copyrect(rect, bitmap.canvas, rect);
//bmp为所要加载的背景
stringgrid1.canvas.textrect(rect, rect.left+2 , rect.top+2,
stringgrid1.cells[acol, arow]);
end;
end ;
你看看stringgrid1.canvas.copyrect(rect, bitmap.canvas, rect);
你明白这句话实际上问题就解决。