[英]Delphi Firemonkey TGrid how to update
我有一个混合列的TGrid(ImageColumn和StringColumn)。 我可以使用onGetValue事件填充它,它可以正常工作。 我的问题是:
如何强制整个网格重建并导致onGetValue事件? 我正在使用UpdateStyle。
如何更新网格中的单个单元格?
网格仅更新可见单元格! Grid1.UpdateStyle
强制网格重建并导致onGetValue
事件,但速度很慢。 Grid1.ReAlign
要快得多。
一旦细胞变得可见,它们就会被更新。
更新1个单元格:
procedure TForm1.UpdateCell(col, row: integer);
var
cell: TStyledControl;
begin
cell := Grid1.Columns[col].CellControlByRow(row);
if Assigned(cell) then
cell.Data := 'Note: use the same datasource as OnGetValue';
end;
当行永远不可见时,不会分配单元格。
另一种选择是调用Grid1.beginUpdate;
进行更改,然后调用Grid1.endupdate;
这将导致可见网格重新计算和重绘。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.