AdvStringGrid 删除数据-LMLPHP

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;
btn1: TButton;
btn2: TButton;
btn4: TButton;
btn5: TButton;
btn6: TButton;
procedure btn1Click(Sender: TObject);
procedure btn2Click(Sender: TObject);
procedure btn4Click(Sender: TObject);
procedure AdvStringGrid1GetAlignment(Sender: TObject; ARow, ACol: Integer;
var HAlign: TAlignment; var VAlign: TVAlignment);
procedure btn5Click(Sender: TObject);
procedure btn6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form6: TForm6; implementation {$R *.dfm} procedure TForm6.AdvStringGrid1GetAlignment(Sender: TObject; ARow,
ACol: Integer; var HAlign: TAlignment; var VAlign: TVAlignment);
begin
HAlign := taCenter;
VAlign := vtaCenter; end; procedure TForm6.btn1Click(Sender: TObject);
var
i,j: Integer;
begin
AdvStringGrid1.WordWrap := False;
AdvStringGrid1.Multilinecells := True;
AdvStringGrid1.Cells[, ] := '小李飞刀';
AdvStringGrid1.Cells[, ] := '';
AdvStringGrid1.Cells[, ] := ''; AdvStringGrid1.Cells[, ] := '小李飞刀';
AdvStringGrid1.Cells[, ] := '';
AdvStringGrid1.Cells[, ] := ''; AdvStringGrid1.Cells[, ] := '火云邪神';
AdvStringGrid1.Cells[, ] := '';
AdvStringGrid1.Cells[, ] := ''; AdvStringGrid1.Cells[, ] := '火云邪神';
AdvStringGrid1.Cells[, ] := '';
AdvStringGrid1.Cells[, ] := ''; AdvStringGrid1.Cells[, ] := '奥巴马';
AdvStringGrid1.Cells[, ] := '';
AdvStringGrid1.Cells[, ] := '';
end; procedure TForm6.btn2Click(Sender: TObject);
begin
//清空N行数据(保留表格)
AdvStringGrid1.ClearRows(, AdvStringGrid1.RowCount - );
end; procedure TForm6.btn4Click(Sender: TObject);
begin
//删除N行数据表格一并删除
AdvStringGrid1.RemoveRows(AdvStringGrid1.Row, );
end; procedure TForm6.btn5Click(Sender: TObject);
begin
//全部清空数据clear(包括标题)
AdvStringGrid1.Clear;
end; procedure TForm6.btn6Click(Sender: TObject);
begin
//全部清空clearAll(包括标题-更深层次慎用-看源码)
AdvStringGrid1.ClearAll;
end; end.
05-11 13:54