如题!

解决方案 »

  1.   

    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
     begin
       if query3.fieldbyname('已选').asboolean=true then  arow:=i1;
      if (Arow=i1) then   begin
     with Stringgrid1.Canvas do
      begin
          FillRect(Rect);
          Font.Color:=clred;
          TextOut(Rect.left,Rect.top,Stringgrid1.cells[Acol,Arow]);
      end;
       end
        else
       with Stringgrid1.Canvas do
         begin
         FillRect(Rect);
          Font.Color:=clblack;
          TextOut(Rect.left,Rect.top,Stringgrid1.cells[Acol,Arow]);
       end;
    end;
      

  2.   

    你可以在DrawCell事件中自画的
    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    用ACol和ARow判断单元格的横坐标和纵坐标,Rect表示当前要自画的Canvas的Rect,然后再State里判断一下单元格的状态
    gdSelected  选择中的单元格
    gdFocused The 单元格获得焦点
    gdFixed 被当作标题栏的单元格
    然后通过StringGrid1.Canvas里的各种属性和方法,想怎么画就怎么画了
      

  3.   

    找到答案了,谢谢大侠!
     StringGrid1.Canvas.Brush.Color:=clred;