Tech Off Post

Single Post Permalink

View Thread: C# 2.0 convert Bitmap to Icon problem
  • User profile image

    The following code fails to create a valid icon recognized by Windows Explorer or VS2005; though, it can be opened in Paint.

    using (Bitmap bmp = new Bitmap(@"C:\ABitmap.bmp"))
          bmp.Save(@"C:\IconFromBitmap.ico", ImageFormat.Icon);

    After googling, a post in MSDN forum was found with similar problem

    The code seems rather straight-forward but it does not appear to do the job.

    Does anyone have a solution?