相关疑难解决方法(0)

将图像转换为c#中的图标

我有一个项目将图像格式文件转换为图标文件.但是,在转换图像后,图像的颜色会发生变化.

这是我的代码

Bitmap theBitmap = new Bitmap(theImage, new Size(width, height));
IntPtr Hicon = theBitmap.GetHicon();// Get an Hicon for myBitmap.
Icon newIcon = Icon.FromHandle(Hicon);// Create a new icon from the handle.
FileStream fs = new FileStream(@"c:\Icon\" + filename + ".ico", FileMode.OpenOrCreate);//Write Icon to File Stream
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

谁知道怎么解决这个问题?

c# bitmap

18
推荐指数
4
解决办法
3万
查看次数

标签 统计

bitmap ×1

c# ×1