首页 > 其他 > 详细

AdvStringGrid 删除数据

时间:2017-05-29 20:52:05      阅读:1056      评论:0      收藏:0      [点我收藏+]

技术分享

 

unit Unit6;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, AdvUtil, Vcl.StdCtrls, Vcl.Grids,
  AdvObj, BaseGrid, AdvGrid;

type
  TForm6 = class(TForm)
    AdvStringGrid1: TAdvStringGrid;
    Button1: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form6: TForm6;

implementation

{$R *.dfm}

procedure TForm6.Button1Click(Sender: TObject);
begin
  AdvStringGrid1.Cells[0, 1] := 小李飞刀;
  AdvStringGrid1.Cells[1, 1] := 1111111;
  AdvStringGrid1.Cells[2, 1] := 2222222;

  AdvStringGrid1.Cells[0, 2] := 火云邪神;
  AdvStringGrid1.Cells[1, 2] := 33333333;
  AdvStringGrid1.Cells[2, 2] := 44444444;
end;

procedure TForm6.Button3Click(Sender: TObject);
begin
  //删除所有数据(剩下空行)
  AdvStringGrid1.ClearRows(1, AdvStringGrid1.RowCount - 1);
end;

procedure TForm6.Button4Click(Sender: TObject);
begin
  //仅清空选中行内容,只剩下空行
  AdvStringGrid1.Rows[AdvStringGrid1.Row].Clear;
end;

procedure TForm6.Button5Click(Sender: TObject);
begin
  //删除行,也没有空行了,整行完全消失:
  AdvStringGrid1.RemoveRows(AdvStringGrid1.Row, 1);
end;

end.

 

AdvStringGrid 删除数据

原文:http://www.cnblogs.com/del88/p/6918974.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!