【发布时间】:2016-01-29 09:41:29
【问题描述】:
我需要从包含多种图像尺寸的图标文件 (.ico) 中检索 最大 位图图像。
在我的图标编辑器中,我可以看到图标文件中有几个图像,分别是 16x16px、24x24、32x32、48x48 和 256x256。
但是,以下代码行错过了我想要的 256x256 图像:
var iconObj = new System.Drawing.Icon(TempFilename); //iconObj is 32x32
//get the 'default' size image:
var image1 = iconObj.ToBitmap(); //retrieved image is 32x32
//get the largest image up to 1024x1024:
var image2 = new System.Drawing.Icon(iconObj, new System.Drawing.Size(1024, 1024)).ToBitmap(); //retrieved image is 48x48
如何从图标文件中获得最大的可用图像(或特定尺寸)?
【问题讨论】:
-
stackoverflow.com/questions/9034170/… 可能会有所帮助。 :O
标签: c# .net system.drawing