22Feb/090
C#: Convert .BMP to .ICO
Some handy code:
public void BitmapToIcon(string sourceFileName, string destFileName) { // Create a Bitmap object from an image file. Bitmap bmp = new Bitmap(sourceFileName); // Get an Hicon for myBitmap. IntPtr Hicon = bmp.GetHicon(); // Create a new icon from the handle. Icon newIcon = Icon.FromHandle(Hicon); //Write Icon to File Stream FileStream fs = new FileStream(destFileName, FileMode.OpenOrCreate); newIcon.Save(fs); fs.Close(); }
Leave a comment