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 firedac内存表

Delphi 的内存操作函数(1): 给字符指针分配内存

Delphi 几个实用的html解析函数

Delphi 获取适合微信使用的当前日期,以int64表示,是当前时间和1970-01-01 00:00:00之间的秒差

Delphi 动态加载删除字体

Delphi tstreamreader tfile assignfile读取文本文件

Delphi system.netencoding

Delphi 如何将颜色值转换为灰度颜色值?

Delphi 网页数据抓取

简单的rs232c/ttl电平转换和串口取电

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



打赏

取消

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

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

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

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

评论

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