Udi,
Unfortunately getting an icon from an image list is a function that is
not exposed in the managed class. However, you can get the icon yourself,
by calling the ImageList_GetIcon function through the P/Invoke layer. You
can pass the handle of the imagelist (exposed by the HandleProperty) to the
function and it will return a handle, which you can then pass to the static
FromHandle property on the Icon class.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Udi" <Ud**********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi,
I have an imagelist initialized in design time with
several icons files (.ico).
However, when I need to extract an icon (Image)
from the Imagelist, I can't convert it back to an icon:
statusBarPanel1.Icon = imageList1.Images[0]; // cast/as don't work
// Cannot convert type 'System.Drawing.Image' to 'System.Drawing.Icon'
What am I mising here?
Thanks!
Udi.