如果我以編程方式將 TComboBox.Images 更改為新的 TImageList,則只有 TComboBox 中選定的圖示會更改,TComboBox(下拉串列)中的所有其他圖示都保持不變。
我有兩個 TImageList,一個帶有彩色圖示,一個帶有黑白圖示,我想將黑白圖示更改為彩色圖示,反之亦然。
procedure TfrmMain.Button1Click(Sender: TObject);
begin
if ComboBox1.Images = ImageList1 then
ComboBox1.Images := ImageList2
else
ComboBox1.Images := ImageList1;
end;

uj5u.com熱心網友回復:
Images正如問題評論中所指出的,這確實是 Delphi 中的一個錯誤,因為在至少顯示一次彈出視窗后更改屬性時,內部下拉串列不會重繪 。這可以通過FMX.ListBox.pas在程序中對源檔案進行小的更改來糾正TCustomComboBox.SetImages:
對于德爾福 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://www.uj5u.com/qianduan/418509.html
標籤:
