.Net ToolStrip and ImageList - wrong image size -
i have icon contains 32-bit images of sizes 16x16, 24x24, , 32x32. create 3 imagelist objects contain 3 different size images, , assign imagelist property on toolstrip given size user selects. images displayed on toolstrip objects scaled versions of 32x32 image. can't figure out why when create 16x16 imagelist, example, doesn't extract 16x16 image icon. code looks this:
imagelist m_imagelist16 = new imagelist(); m_imagelist16.colordepth = system.windows.forms.colordepth.depth32bit; m_imagelist16.imagesize = new system.drawing.size(16, 16); m_imagelist16.transparentcolor = system.drawing.color.transparent; // open icon in resources contains various sizes of images. m_imagelist16 .images.add(global::mytestapp.properties.resources.open); // later when user selects 16 size menu, change toolbar: m_toolbar.imagescalingsize = new size(16, 16); m_toolbar.imagelist = m_imagelist16;
it seems takes 32x32 size image in icon , scales down 16x16, rather using 16x16 image defined in icon. can this? in advance input!
- steve
i can't find evidence support theory, imagelist appears not aware of selecting different size icons. hunch converts icons bitmaps , stores data.
at msdn forums, found snippet mvp user nobugz:
i think can reproduce problem. when use microangelo (an icon editor utility) extract icon #5 shell32.dll, save disk, add icon 16x16 imagelist, see poorly interpolated version of icon. when edit icon , remove formats except 16x16x256 colors, nice sharp looking version of icon.
looks imagelist isn't smart enough select icon best matches imagelist's imagesize , colordepth property. never particularly smart control. doesn't quite match scenario outcome same. seeing physicaldimension of 32x32 hints went wrong when extracted icon. see 16x16 on edited icon 32x32 on un-edited icon.
also, this page csharpkey seemed useful resource working imagelists , icons. here's excerpt:
if creating list of icons, can create each default size of 16x16. in cases (for example if intend use images list view), can create or design second set of icons size 32x32 (and/or 48x48) each.
it seems be, "reading between lines" imagelist merely stores 1 size , returns resampled versions of image stored.
edit
i found reference @ codeproject (embedding icons in vb.net application) says this:
well, seemed pretty solution, until realized an imagelist stores images bitmaps @ single resolution. if have these great icons in various sizes want use throughout application, maybe using different sizes (since icons have multiple sizes stored within single file), imagelist wasn't quite going cut it.
Comments
Post a Comment