ImageList中的图标大小 [英] Icon size in an ImageList

查看:141
本文介绍了ImageList中的图标大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

同事,

如您所知,.ico文件包含具有不同大小和颜色深度的多个图像.为了在树形视图中显示一个16x16的图标,我找到了一个.ico文件,该文件除其他尺寸外还具有适当的尺寸图像.我有一个ImageList,其中ImageSize设置为16x16.在设计时,我已将.ico加载到ImageList中.但是ImageList将此图标的PhysicalDimension显示为32x32(PhysicalDimension是只读的).看起来ImageList选择了错误的大小.

解决方法是,我可以提取所需的16x16图像并将其另存为单独的文件(可能采用其他格式).但是,是否有办法使ImageList从.ico文件中选择正确的大小?

任何建议,见解或参考都将受到赞赏!

-Nick

Colleagues,

As you know, the .ico files contain multiple images with different sizes and color depths. To display a 16x16 icon in my tree view, I found an .ico file which has the appropriate size image among other sizes. I’ve got an ImageList, with ImageSize set to 16x16. At design time, I’ve loaded the .ico into the ImageList. But the ImageList shows PhysicalDimension for this icon as 32x32 (PhysicalDimension is read-only). Looks like ImageList chose the wrong size.

As a workaround, I can extract the needed 16x16 image and save it as a separate file (may be in a different format). But, is there a way to make ImageList pick the right size from the .ico file?

Any suggestion, insight or reference is appreciated!

- Nick

推荐答案

System.Windows.Forms.ImageList设计用于位图,而不是图标.在使用它的地方(TreeView的图像等),不需要图标.如果您确实需要图标,则表示您不需要ImageList;使用名称空间System.Collections.Generic中您喜欢的任何容器.

—SA
The class System.Windows.Forms.ImageList is designed to be used with bitmaps, not icons. Where it is used (images for TreeView and the like), icons are not needed. If you really need icons, it means you don''t need ImageList; use any container you prefer from the namespace System.Collections.Generic.

—SA


这篇关于ImageList中的图标大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆