如何在STINGRID中更改单元格颜色并能拆分表格!

解决方案 »

  1.   

    procedure TFrmArchives.StringGridDrawCell(Sender: TObject; ACol,
      ARow: Integer; Rect: TRect; State: TGridDrawState);
    var
      i,k: integer;
    begin
      inherited;
      with StringGrid do
      begin
        k:=m_Row;
        for i:=1 to ColCount-1 do
        begin
          Rect:=CellRect(i,k);
          if not ((Rect.Right=0) and (Rect.Left=0)) then
          begin
            Canvas.Brush.Color:=clMoneyGreen;
            Canvas.FillRect(Rect);
            Canvas.TextOut(Rect.left+2,Rect.top+2,Cells[i,k]);
          end;
        end;
      end;
    end;
    procedure TFrmArchives.StringGridSelectCell(Sender: TObject; ACol,
      ARow: Integer; var CanSelect: Boolean);
    begin
      with StringGrid do
      begin
      
      m_Row:=ARow;  Refresh;
      end;
    end;
      

  2.   

    yong idstringgrid 空间,我用国