AdvStringGrid 刪除數據
阿新 • • 發佈:2017-05-29
ctr graph nts mov system 技術 src 分享 message
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 刪除數據