[英]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.