简体   繁体   中英

Change icon's format in C# Designer?

alt text http://i.imagehost.org/0734/Untitled_11.gif

How do I change the icon PictureBox shows?

The icon itself has multiple icons in it with different formats but for some reason the 16x16 is always used. How do I change that?

eg 32x32 , 48x48

Windows Forms has very poor support for icons. That starts with the Icon class itself, it has no way to enumerate the images in the icon or way to select which image is used in its ToBitmap() method. Fixing this got to be difficult with Vista, it expanded the icon file format to also support large images in the PNG format. Also not supported by Icon.

Punt this problem and convert the icon to a bitmap yourself. Visual Studio supports this, File + Open File, select your icon. Image + Current Icon Images Types, select the one you want to convert. Edit + Copy, that puts a bitmap of the icon on the clipboard. Paste into a new bitmap. Saving as a .png is best so that it can still support background transparency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM