"Stanley" <se****@email.com> scripsit:
I wish to set Form.Icon from an image list but seems like the image list
didn't provide a method to extract the image as an Icon type.
Thus, can anyone show me a way the conversion
From: System.Drawing.Image
To: System.Drawing.Icon
Or show me an easy way to set the Form.Icon from an image list.
You may want to store the icons as embedded resources instead of an imagelist.
Add the icon file to your project and set its 'Build Action' property to 'Embedded Resource'. You can use the code below to load the icon at runtime:
\\\
foo.Icon = _
New Icon( _
[Assembly].GetExecutingAssembly().GetManifestResourceStream( _
"WindowsApplication1.Ball.ico" _
) _
)
///
'WindowsApplication1' is the root namespace of the application, "Ball.ico"
is the icon's filename.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>