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[, ] := '小李飞刀';
AdvStringGrid1.Cells[, ] := '';
AdvStringGrid1.Cells[, ] := ''; AdvStringGrid1.Cells[, ] := '火云邪神';
AdvStringGrid1.Cells[, ] := '';
AdvStringGrid1.Cells[, ] := '';
end; procedure TForm6.Button2Click(Sender: TObject);
begin
//取当前姓名
ShowMessage(AdvStringGrid1.Cells[, AdvStringGrid1.Row]);
end; procedure TForm6.Button3Click(Sender: TObject);
begin
//去当前单元格
ShowMessage(AdvStringGrid1.Cells[AdvStringGrid1.Col, AdvStringGrid1.Row]);
end; end.