自己收藏的,全给你了:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
vrect:trect;
begin
if (a>0) and (b>0) then
Begin
vRect := StringGrid1.CellRect(a,b);
StringGrid1.Canvas.Font.Color := clRed;
StringGrid1.Canvas.TextRect(vRect,vRect.left+2,vRect.top+1,StringGrid1.Cells[a,b]);
end;
end;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
a := ACol;
b := ARow;
end;