要么设置为True,要么在OnDrawCell里自己画。

解决方案 »

  1.   

    使用STRINGGRID中使用不同的颜色
    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
    //  if gdSelected in state then exit;  with StringGrid1.canvas do begin       if gdselected in state then
             begin          brush.color:=clBackground;          Rectangle(Rect.Left-1, Rect.Top-1, Rect.Right+1, Rect.Bottom+1);
              textout(rect.left,rect.top,stringgrid1.cells[acol,arow]);
              exit;
              end;
           if (arow=0)  then          //brush.color:=clScrollBar
              begin          brush.color:=clmenu;
              pen.color:=clblack;
              Rectangle(Rect.Left-1, Rect.Top-1, Rect.Right+1, Rect.Bottom+1);
              textout(rect.left,rect.top,stringgrid1.cells[acol,arow]);
              exit;
              end
           else
              begin
              //pen.color:=$00EBEBEB;
           if (arow mod 2)=0 then
              begin
              brush.color:=$00EEEEEE;
              pen.color:=$00EEEEEE;
              end
           else
              begin
              brush.color:=$00F5F5EB;
              pen.color:= $00F5F5EB;
              end;
       end;       Rectangle(Rect.Left-1, Rect.Top-1, Rect.Right+1, Rect.Bottom+1);
           //pen.color:=clblack;       textout(rect.left,rect.top,stringgrid1.cells[acol,arow]);  end;
    end;