Delphi 删除或清除TStringGrid中的行


本文整理自网络,侵删。

 type
  TStringGridRowDeletion = class helper for TStringGrid
  public
    procedure RemoveRows(RowIndex, RCount: Integer);
    procedure Clear;
  end;


{ TStringGridRowDeletion }
 
procedure TStringGridRowDeletion.Clear;
var
  i: integer;
begin
  for i := 0 to RowCount -1 do
    RemoveRows(0, RowCount);
end;
 
procedure TStringGridRowDeletion.RemoveRows(RowIndex, RCount: Integer);
var
  i: Integer;
begin
  for i := RowIndex to RowCount - 1 do
    Rows[i] := Rows[i + RCount];
  RowCount := RowCount -RCount;
end;




var
  myStringGrid: TStringGrid;
begin
  ...
  myStringGrid.RemoveRows(0, 4);
  ...
end;

相关阅读 >>

Delphi 判断端口(port)是否被占用

Delphi 中的字符串

Delphi 10.4.1 edgebrowser 模拟操作网页方法

重新组织编写Delphi的md2、md4、md5类

Delphi fdquery 判断记录为空

Delphi获取计算机的工作组信息和获取工作组中的计算机名称

Delphi 播放声音 采用 异步方式,比较流畅

Delphi检查是否在64位windows环境中运行?

Delphi 复制拷贝文件目录函数

Delphi 几个实用的html解析函数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...