如提

解决方案 »

  1.   

    for i:=1 to 10
    begin
      StringGrid1.Cells[0,StringGrid1.RowCount-1]='你好';
      StringGrid1.RowCount := StringGrid1.RowCount+2;
    End;
    这样子不需要判断,速度又快!
      

  2.   

    我的解决方法,大家吃火锅吧
    with TStringGrid(Sender) do begin
        if ((State = [gdSelected]) or (State = [gdSelected, gdFocused])) then begin
            Canvas.Font.Color := clHighlightText;
            Canvas.Brush.Color := clHighlight;
        end else
          with Canvas do
          if (ARow mod 2) <> 0 then
          begin
              Brush.Color:=clInfoBk;
              Font.Color:=clblack;
              TextRect(Rect, Rect.Left, Rect.Top, Cells[ACol, ARow]);
          end else Canvas.brush.Color := clWhite;
      end;