procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  with StringGrid1 do
    with Canvas do
    begin
      if (ARow=Row)and(ACol>=FixedCols) then  //设置你的条件
        Font.Color:=clRed
      else
        if (ARow>=FixedRows)and(ACol>=FixedCols) then Font.Color:=clBlack;
      FillRect(Rect);
    end;end;

解决方案 »

  1.   

    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
      with StringGrid1 do
      begin
        if ARow mod 2 = 0 then
          Canvas.Font.Color := clRed
        else
          Canvas.Font.Color := clGreen;
        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
     if (acol = 2) and(arow >0) then
      begin
      stringgrid1.Font.Color:=clRed;
    end;
    这样不可以吗?
      

  3.   

    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
    if (acol = 2) and(arow >0) then
      stringgrid1.Font.Color:=clRed;
    end;
      

  4.   

    不好意思
      l_kaifeng(江南大哥) 好像不行
      taxi(游少爷) 可以l_kaifeng(江南大哥)再试一下等下按功全部一起给分
      

  5.   

    to   l_kaifeng
    的是不是条件只能是Row or col
    for example ;
      if cell[1,arow] = 'a' then 
         font.color := clred
    并且Arow这一行都为Red
    好何做
         
    因为我也用,可能某处没设好,不行