首先你要知道,你要在那一格画什么?
然后在StringGrid1DrawCell 里面画上就可以了,例如你要在3,4位置放一副图片的话procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
aRect: TRect; State: TGridDrawState);
var
Bitmap:TBitmap;
r:TRect;
begin
if((aCol=3) and (aRow = 4)) then
begin
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('abc.bmp');
r := Rect(0,0,Bitmap.Width,Bitmap.Height);
StringGrid1.Canvas.CopyRect(aRect,Bitmap.Canvas,r);
Bitmap.Free;
end;
end;大概就是这样一个过程
然后在StringGrid1DrawCell 里面画上就可以了,例如你要在3,4位置放一副图片的话procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
aRect: TRect; State: TGridDrawState);
var
Bitmap:TBitmap;
r:TRect;
begin
if((aCol=3) and (aRow = 4)) then
begin
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('abc.bmp');
r := Rect(0,0,Bitmap.Width,Bitmap.Height);
StringGrid1.Canvas.CopyRect(aRect,Bitmap.Canvas,r);
Bitmap.Free;
end;
end;大概就是这样一个过程
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货