以前可没想到过这个问题,估计没有简单的办法,只能是把第5行以后的数据往上复制,然后将RowCount设成小一个吧。找时间我好好看看它的源程序。

解决方案 »

  1.   

    就按agui(阿贵)的很好呀:procedure delrow(stringgrid:Tstringgrid;Row:integer);
    var
    i,j,mrow,mcol:integer;
    begin
      if row<1 then   //没有选择的行
        exit;  with stringgrid do
      begin
        mrow:=RowCount;
        mcol:=ColCount;
        for i:=row to mrow-1-1 do
          for j:=1 to mcol-1 do
          cells[j,i]:=cells[j,i+1];
        rowcount:=rowcount-1;
      end;
    end;
      

  2.   

    procedure delrow(stringgrid:Tstringgrid;Row:integer);
    var
    i,j,mrow,mcol:integer;
    begin
      if row<1 then  //没有选择的行
        exit;
      with stringgrid do
      begin
        mrow:=RowCount;
        mcol:=ColCount;
        for i:=row to mrow-2 do
          Rows.Assign(Rows[i+1]);  
        rowcount:=rowcount-1;
      end;
    end;
      

  3.   

    procedure delrow(stringgrid:Tstringgrid;Row:integer);
    var
    i,j,mrow,mcol:integer;
    begin
      if row<1 then  //没有选择的行
        exit;
      with stringgrid do
      begin
        mrow:=RowCount;
        mcol:=ColCount;
        for i:=row to mrow-2 do
          Rows[i].Assign(Rows[i+1]);  
        rowcount:=rowcount-1;
      end;
    end;
      

  4.   

    高,实在是高
    genphone_ru(票票):交个朋友