>?

解决方案 »

  1.   

    StringGrid1.RowCount:=StringGrid1.RowCount-1;
      

  2.   

    StringGrid1.RowCount:=StringGrid1.RowCount-1;
      

  3.   

    procedure DeleteLine(AStrGrid: TStringGrid; ARow: Integer);
    var
       intNo: Integer;
    begin
       if Assigned(AStrGrid) and (ARow >= 0)
             and (ARow < AStrGrid.RowCount) then
          with AStrGrid do
          begin
             // 移动行的字符串
             for intNo := ARow to RowCount - 2 do
                Rows[intNo] := Rows[intNo + 1];         // 行数减 1
             RowCount := RowCount -1;
          end;
    end;
      

  4.   

    type
      TmyGrid=class(TStringGrid);
    ......
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
     TmyGrid(StringGrid1).deleterow(1);
    end;