using System.Drawing;using System.Windows.Forms; namespace WindowsFormsApplication1{ public partial class Form1 : Form { public Bitmap FromIconToBitmap(Icon icon) { Bitmap bmp = new Bitmap(icon.Width, icon.Height); using (Graphics gp = Graphics.FromImage(bmp)) { gp.Clear(Color.Transparent); gp.DrawIcon(icon, new Rectangle(0, 0, icon.Width, icon.Height)); } return bmp; } private void Button1_Click(System.Object sender, System.EventArgs e) { Icon icon = WindowsFormsApplication1.Properties.Resources.Icon1; pictureBox1.Image = FromIconToBitmap(icon); } }}
Richard Mueller edited Revision 1. Comment: Removed (en-US) from title, modified title, added tag, improved grammar