AdvStringGrid 获取值
Posted 不能富贵难成大器皆因懒, 胸无大志庸庸碌碌只为闲。
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AdvStringGrid 获取值相关的知识,希望对你有一定的参考价值。
stringGrid.row stringgrid.col分别为当前行和列
stringGrid.cells[stringgrid.col,stringGrid.row]就是当前cell的值
----------------------------------------------------------------
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; 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 获取值的主要内容,如果未能解决你的问题,请参考以下文章