没有先成的method ,只有自己写
删除:
num:=stringgrid.rowcount;
for i:=del_no to num do
  stringgrid.rows[i]:=stringgrid.row[i+1];
stringgrid.rowcount:=stringgrid.rowcount-1;
插入同理

解决方案 »

  1.   

    {删除当前行}
    procedure TForm1.Button1Click(Sender: TObject);
    var
       i:integer;
    begin
      for i:=stringgrid1.row to stringgrid1.RowCount-1 do
              stringgrid1.Rows[i]:=stringgrid1.Rows[i+1];
      stringgrid1.RowCount:=stringgrid1.RowCount-1;//删除
    end;{增加一行}
    procedure TForm1.Button2Click(Sender: TObject);
    var
       i,frow:integer;
    begin
        frow:=stringgrid1.row;//记录当前选定行的位置
        stringgrid1.rowcount:=stringgrid1.rowcount+1;
        for i:=stringgrid1.rowcount downto frow do
          stringgrid1.Rows[i]:=stringgrid1.Rows[i-1];
        stringgrid1.Rows[frow].Clear;
    end;
      

  2.   

    1: 在Stringgrid.selectcell事件中.全局变量:iRow;
    Stringgrid1selectcell(sender:Tobject.....)
    Begen
      iRow:=ARow;
    end;
    btnclick(sender:Tobject)
    begin
      stringgrid1.delete(irow);
    end;
    2:
     btn2click(sender:Tobject)
    var i:integer;
    begin
     For i:=0 to yourcount do
      begin
        StringGrid1.cell[yourcolumn,i]:=yourvalues;
      end;
    end;