首页 > 代码库 > 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 获取值
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。