Reputation: 310802
Icon files (*.ico) may contain multiple images at different sizes and of different colour depths.
How can I obtain a System.Drawing.Image
object from a .ico
file?
One option is Image.FromFile(...)
, but for icon files with multiple images there is no way to specify which image size and colour depth to return.
Ideally the solution would use only managed code, but I'm happy to hear about interop calls to Win32 functions as well.
Upvotes: 4
Views: 5598
Reputation: 39413
You will need to use
Dim icon As System.Drawing.Icon
icon = icon.FromHandle(hIcon)
In the hIcon structure you can specify the color depth
This links will guide you in the right direction:
Upvotes: 0
Reputation: 8202
System.Drawing.Icon can load a specified size from a file. I don't know about depth, though. http://msdn.microsoft.com/en-us/library/ms142130.aspx
Upvotes: 0