Fixed: mismatched icons on treeview update

This commit is contained in:
Ray 2021-10-12 19:20:17 +01:00
parent 60f199b0f2
commit f7d6b1c6a6
1 changed files with 4 additions and 5 deletions

View File

@ -817,6 +817,10 @@ namespace RyzStudio.Windows.Forms
if (string.IsNullOrWhiteSpace(item.SiteAddress)) return (int)IconSet.Default;
string iconID = item?.ToHash();
if (this.ImageList.Images.ContainsKey(iconID))
{
return this.ImageList.Images.IndexOfKey(iconID);
}
Image image = this.IconDatabase.FindIcon(iconID);
if (image == null)
@ -824,11 +828,6 @@ namespace RyzStudio.Windows.Forms
return (int)IconSet.Default;
}
if (this.ImageList.Images.ContainsKey(iconID))
{
this.ImageList.Images.RemoveByKey(iconID);
}
ThreadControl.Add(this, this.ImageList, iconID, image);
return this.ImageList.Images.IndexOfKey(iconID);