写OnDrawCell事件,改变字体即可。

解决方案 »

  1.   

    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
      //根据不同的单元格设置不同的字体
      if Acol=2 then
      with StringGrid1 do
      begin
        Canvas.Font.Color := clred;
        Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[ACol,ARow]);
      end;
      //...其他限制条件
    end;
      

  2.   

    再举个例子:
    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
      {根据单元格内值的不同设置不同的字体}
      with StringGrid1 do
        if Cells[ACol,ARow]<>'' then
          if StrToFloat(Cells[ACol,ARow])>10 then //其实这里你可以具体到某一列或某一行
          begin
            Canvas.Font.Color := clred;
            Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[ACol,ARow]);
          end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      StringGrid1.Cells[random(10),random(10)] := FormatFloat('0.00',random(100)/5);
    end;
      

  3.   

    同意,chinajavis(我选择 我喜欢)  
    是正解