如果我以编程方式将TComboBox.Images更改为新的TImageList,则只更改TComboBox中选定的图标,则TComboBox (下拉列表)中的所有其他图标保持不变。
我有两个TImageLists,一个有彩色图标,一个有黑白图标,我想将黑白图标更改为彩色图标,反之亦然。
procedure TfrmMain.Button1Click(Sender: TObject);
begin
if ComboBox1.Images = ImageList1 then
ComboBox1.Images := ImageList2
else
ComboBox1.Images := ImageList1;
end;

发布于 2022-01-14 16:07:48
正如问题注释中指出的,这确实是Delphi中的一个错误,因为在显示弹出后至少一次更改Images属性时不会刷新内部下拉列表。通过在FMX.ListBox.pas过程中对TCustomComboBox.SetImages源文件进行小改动,可以纠正这一点:
对于Delphi 11:
procedure TCustomComboBox.SetImages(const Value: TCustomImageList);
begin
FImageLink.Images := Value;
FItemsChanged := True; // <- Add this
end;特尔斐10.4 CE:
procedure TCustomComboBox.SetImages(const Value: TCustomImageList);
begin
FImageLink.Images := Value;
TComboBoxHelper.SetItemsChanged(Self, True); // <- Add this
end;https://stackoverflow.com/questions/70520388
复制相似问题