web analytics

How to Convert Icon between Image in C#?

Options

davegate 143 - 921
@2016-02-13 20:46:21

Icon to Image

The following code shows how to convert an Icon to Image:

Icon a = new Icon("c:\\myicon.ico");
Image im = a.ToBitmap();
@2016-02-13 20:46:52

Image to Icon

The following code shows how to convert an Image to an Icon:

System.Drawing.Bitmap bmp = new System.Drawing.Bitmap("c:\\myimage.gif");

System.IntPtr iconHandle = bmp.GetHicon();
Icon icon = System.Drawing.Icon.FromHandle(iconHandle);

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com