FireUI的TStringGrid - 在绘制时设置值

时间:2016-04-07 15:59:30

标签: delphi firemonkey

我使用Delphi XE7的FireMonkey TStringGrid让它拥有一百万行。用数百万个字符串填充TStringGrid的内容会消耗太多内存。

如何在绘制单元格时设置它们的值?

当代码滚动到视图中时,我的代码会从一个巨大的临时文件中填充单元格的内容。

我的应用程序的旧版本中的TurboPower Orpheus TOvcTable组件使用名为OnGetCellData()的钩子完成此操作。我没有在FireUI的TStringGrid中看到类似的内容。

1 个答案:

答案 0 :(得分:4)

而不是TStringGrid使用TGridTColumn列。然后使用OnGetValue事件获取要在网格中显示的值。这最接近VCL s TDrawGrid

procedure TForm1.Grid1GetValue(Sender: TObject; const Col, Row: Integer;
  var Value: TValue);
begin
  Value := inttostr(col)+', '+inttostr(row);
end;

10 mio行的网格示例结果:

enter image description here