Menubar Icons are missing if I'm using imagekey instead of imageindex

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
monoeagle
Posts: 107
Joined: Tue Oct 13, 2015 9:10 am

Menubar Icons are missing if I'm using imagekey instead of imageindex

Post by monoeagle » Wed Sep 20, 2017 9:04 am

Hi@All,

PSS 2017 last Patchlevel
W7 x64

Building a menubar with icon wasn't that difficult, imagelist, adding images, set the imageindex on the button voala.
Bildschirmfoto 2017-09-20 um 17.49.44.png
Bildschirmfoto 2017-09-20 um 17.49.44.png (20.66 KiB) Viewed 585 times
But if I use imagekey instead the result is a button line without any icon.
Bildschirmfoto 2017-09-20 um 17.50.20.png
Bildschirmfoto 2017-09-20 um 17.50.20.png (11.75 KiB) Viewed 585 times
I don't know if it is a bug or as designed?
Bildschirmfoto 2017-09-20 um 18.01.36.png
Bildschirmfoto 2017-09-20 um 18.01.36.png (45.95 KiB) Viewed 585 times
In the imagekey place I can select the appropirate image as it should be, but with no result.

regards

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Menubar Icons are missing if I'm using imagekey instead of imageindex

Post by davidc » Wed Sep 20, 2017 9:47 am

You will need to use the ImageIndex, because of the way it serializes the binary data in the script, it is unable to retain that ImageKey information.
David
SAPIEN Technologies, Inc.

User avatar
monoeagle
Posts: 107
Joined: Tue Oct 13, 2015 9:10 am

Re: Menubar Icons are missing if I'm using imagekey instead of imageindex

Post by monoeagle » Wed Sep 20, 2017 10:35 am

ok that sounds plausible

what is a scenario where I have to use imagekey?

if the files are physical on the hdd as files?

Locked