1.属性:DrawAutomatic = False.
2.create a method for the OnDrawCell event.The OnDrawCell event would look something like:
  var
    Text: array[0..255] of Char;
  begin
  StrPCopy (Text, StringGrid1.Cells[Row, Col]);
  if Col = 2 then
    StringGrid1.Canvas.Brush.Color := clYellow
  else
    StringGrid1.Canvas.Brush.Color := clWhite;
  ExTextOut (..., Rect.Left + 2, Rect.Bottom + 2, ..., Text, StrLen (Text));
  end;上面的代码将第三行画成黄色,其他为白色。(参考:GRIDS.PAS - VCL原代码)

解决方案 »

  1.   

    to:sleepwalk(梦游) :
    大哥,你说的我已作到了,我要的是这个string的颜色,最起码这个string所在单元格颜色,而不是这一行,再指点指点,多谢!
      

  2.   

    其实类似,只要如下:
      If ( Cells[Col, Row] = '中国' ) Then
        Canvas.Font.Color := clRed
      Else
        Canvas.Font.Color := clBlack;
      ExTextOut (..., Rect.Left + 2, Rect.Bottom + 2, ..., Text, StrLen (Text));
      

  3.   

    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
      //根据你的条件选择要特殊显示的ACol, ARow 
      //设置Canvans.Color
      TextRect(Rect, Rect.Left, Rect.Top, Cells[ACol, ARowl]);
      (Sender as TstringGrid).Invalidiate;
    end;