码迷,mamicode.com
首页 > 其他好文 > 详细

AdvStringGrid 删除数据

时间:2017-05-29 21:04:12      阅读:390      评论:0      收藏:0      [点我收藏+]

标签:dial   blog   procedure   win   分享   com   move   span   dia   

技术分享

 

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 删除数据

标签:dial   blog   procedure   win   分享   com   move   span   dia   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!