将stringgrid的defaultdrawing属性改为false,然后: procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin if (acol=1) and (arow=1) then rect.Bottom:=rect.Bottom+rect.Bottom-rect.Top; if not((acol=1) and (arow=2)) then begin stringgrid1.Canvas.FillRect(Rect); stringgrid1.canvas.textout(rect.left,rect.top+18,StringGrid1.cells[acol,arow]); end; end;
多个cell就.........不过有个苯方法:动态的画个edit上去,把各个cells
的内容写到edit中就可以了!
将stringgrid的defaultdrawing属性改为false,然后:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if (acol=1) and (arow=1) then
rect.Bottom:=rect.Bottom+rect.Bottom-rect.Top;
if not((acol=1) and (arow=2)) then
begin
stringgrid1.Canvas.FillRect(Rect);
stringgrid1.canvas.textout(rect.left,rect.top+18,StringGrid1.cells[acol,arow]);
end;
end;