Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi 如何在FireMonkey TStringgrid中取消选择单元格_Delphi_Firemonkey_Tstringgrid - Fatal编程技术网

Delphi 如何在FireMonkey TStringgrid中取消选择单元格

Delphi 如何在FireMonkey TStringgrid中取消选择单元格,delphi,firemonkey,tstringgrid,Delphi,Firemonkey,Tstringgrid,是否有人知道如何在FireMonkey TStringgrid中取消选择单元格(换句话说,我需要知道选择了哪个单元格以及如何取消选择) 我们使用的是Delphi Berlin 10.1 提前感谢。要获取当前选定的行,请使用selected属性。要获取当前选定的列,请使用ColumnIndex属性。行和列索引从0开始 要取消选择,您可以选择将Selected和ColumnIndex设置为f。例1 使用此代码进行测试: procedure TForm29.Button1Click(Sender: T

是否有人知道如何在FireMonkey TStringgrid中取消选择单元格(换句话说,我需要知道选择了哪个单元格以及如何取消选择)

我们使用的是Delphi Berlin 10.1


提前感谢。

要获取当前选定的行,请使用
selected
属性。要获取当前选定的列,请使用
ColumnIndex
属性。行和列索引从0开始

要取消选择,您可以选择将
Selected
ColumnIndex
设置为f。例1

使用此代码进行测试:

procedure TForm29.Button1Click(Sender: TObject);
var
  SelRow, SelCol: integer;
begin
  SelRow := StringGrid1.Selected;
  SelCol := StringGrid1.ColumnIndex;
  Memo1.Lines.Add(Format('SelRow: %d, SelCol: %d',[SelRow, SelCol]));
  StringGrid1.Selected := -1;
  StringGrid1.ColumnIndex := -1;
  SelRow := StringGrid1.Selected;
  SelCol := StringGrid1.ColumnIndex;
  Memo1.Lines.Add(Format('SelRow: %d, SelCol: %d',[SelRow, SelCol]));
end;

Selected
属性提供所选行索引。
ColumnIndex
属性提供所选列。除了选择另一个单元格外,我找不到取消选择的方法。看见