首页 > 代码库 > AdvStringGrid 获取值

AdvStringGrid 获取值

stringGrid.row stringgrid.col分别为当前行和列
stringGrid.cells[stringgrid.col,stringGrid.row]就是当前cell的值

----------------------------------------------------------------

技术分享

 

unit Unit6;interfaceuses  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;    Button2: TButton;    Button3: TButton;    procedure Button1Click(Sender: TObject);    procedure Button2Click(Sender: TObject);    procedure Button3Click(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.Button2Click(Sender: TObject);begin  //取当前姓名  ShowMessage(AdvStringGrid1.Cells[0, AdvStringGrid1.Row]);end;procedure TForm6.Button3Click(Sender: TObject);begin  //去当前单元格  ShowMessage(AdvStringGrid1.Cells[AdvStringGrid1.Col, AdvStringGrid1.Row]);end;end.

 

AdvStringGrid 获取值