我怎样才能提取在.NET中的图标文件中的特定图像?图标、图像、文件、NET

2023-09-03 05:26:52 作者:﹎簖嚸

图标文件(* .ICO)可以包含多个图像在不同的颜色深度的不同尺寸和

Icon files (*.ico) may contain multiple images at different sizes and of different colour depths.

我怎样才能获得从为System.Drawing.Image 对象 .ICO 文件?

How can I obtain a System.Drawing.Image object from a .ico file?

一个选项是 Image.FromFile(...),但对多个图像图标文件有没有办法来指定图像的大小和颜色深度要返回的。

One option is Image.FromFile(...), but for icon files with multiple images there is no way to specify which image size and colour depth to return.

理想的解决方案将使用唯一的管理code,但我很高兴听到互操作调用Win32函数为好。

Ideally the solution would use only managed code, but I'm happy to hear about interop calls to Win32 functions as well.

推荐答案

简单的回答您的所有问题:的 IconLib

Simple answer to all your questions: IconLib