Final few tweaks to shortcut image selection

The ChooseImageForm list now correctly higlights and selects the selected image when it's refreshed.
This commit is contained in:
Terry MacDonald 2021-11-05 16:36:39 +13:00
parent 9e91e0fd45
commit 5f2b018725
2 changed files with 5 additions and 6 deletions

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")] [assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information // Version information
[assembly: AssemblyVersion("2.1.0.157")] [assembly: AssemblyVersion("2.1.0.159")]
[assembly: AssemblyFileVersion("2.1.0.157")] [assembly: AssemblyFileVersion("2.1.0.159")]
[assembly: NeutralResourcesLanguageAttribute( "en" )] [assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)] [assembly: CLSCompliant(true)]

View File

@ -78,9 +78,6 @@ namespace DisplayMagician.UIForms
lv_icons.Items.Clear(); lv_icons.Items.Clear();
if (AvailableImages.Count > 0) if (AvailableImages.Count > 0)
{ {
bool alreadySelected = false;
// Load all the images into the list
int imageCount = 1;
foreach (ShortcutBitmap sc in AvailableImages) foreach (ShortcutBitmap sc in AvailableImages)
{ {
string[] stringsToAdd = new string[] { string[] stringsToAdd = new string[] {
@ -89,9 +86,11 @@ namespace DisplayMagician.UIForms
}; };
ListViewItem lvi = new ListViewItem(stringsToAdd); ListViewItem lvi = new ListViewItem(stringsToAdd);
lvi.Name = sc.UUID; lvi.Name = sc.UUID;
if (sc.Equals(SelectedImage)) if (ImageUtils.ImagesAreEqual(sc.Image,SelectedImage.Image))
{ {
lvi.Selected = true; lvi.Selected = true;
lvi.Focused = true;
lvi.EnsureVisible();
pb_selected_icon.Image = SelectedImage.Image; pb_selected_icon.Image = SelectedImage.Image;
_selectedImage = sc; _selectedImage = sc;
} }