views:

354

answers:

3

Here's the code that I use to extract the icon size that I want:

    Dim i As Icon = My.Resources.Spectrum
    Using i2 As New Icon(i, New Size(256, 256))
        Me.PictureBox1.Image = i2.ToBitmap
    End Using

This works from 16x16 up to 128x128 but for 256x256 it extracts the 128x128 icon. I tried 0x0, because I seem to remember that that is how the large size is stored in the meta data, but that didn't work either.

A: 

stupid question... are you sure your resource contains the 256x256 version of the icon?

smnbss
24 seconds in front. :)
ZombieSheep
24 seconds late, so you just get a referral to the comment under ZombieSheep!
Jules
Ah, but I meant he was 24 seconds ahead of me. :)
ZombieSheep
and we were both wrong :)
smnbss
+1  A: 

Are you sure your source actually contains a 256x256 resource? Have you tried against a different source icon?

ZombieSheep
Yes, my app queries the meta data and displays the sizes available. Besides that, I've tested it on icons that I know have a 256x256 icon because I've opened them up in an icon editor.
Jules
+2  A: 

http://stackoverflow.com/questions/220465/using-256-x-256-vista-icon-in-application/1945764#1945764

danbystrom
I tried that earlier and it failed on the 'bmpPngExtracted = New Bitmap(destStream)' line with a 'Parameter is not valid' exception. I've just tried it on another icon and it worked. I just need to find out why it failed on the other icon ...
Jules