简体   繁体   English

Delphi FMX TListview - 如果表 Blob 为空,则显示默认 png

[英]Delphi FMX TListview - display a default png if table Blob is null

Instead of storing a default.png into every row of the database where the image is empty (waste of database space), is there a way to display this default.png in the Listview wherever image is empty/null in the table?不是将 default.png 存储到图像为空的数据库的每一行(浪费数据库空间),有没有办法在表中图像为空/空的地方在 Listview 中显示这个 default.png?

(I'm using livebindings by code). (我正在通过代码使用实时绑定)。

You can check and set in ListView UpdateObjects Event:您可以在 ListView UpdateObjects 事件中检查和设置:

procedure TForm1.ListView1UpdateObjects(const Sender: TObject;
  const AItem: TListViewItem);
begin
  if not Assigned(AItem.Bitmap) then
    AItem.Bitmap.Assign(Image1.Bitmap);
end;

best regards此致
Moskw@莫斯科@

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM