CSharp examples for System.Drawing:Image Convert
Converts a Bitmap to an Icon
using System.IO;//w w w . jav a2 s .c o m using System.Drawing; public class Main{ /// <summary> /// Converts a <see cref="Bitmap"/> to a <see cref="Icon"/> /// </summary> public static Icon ToIcon(this Bitmap bitmap) { try { if (bitmap != null) { return Icon.FromHandle(bitmap.GetHicon()); } } catch { return null; } return null; } }