从Imagelist中读取图像名称 [英] Read Image Name from Imagelist

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

问题描述

我想在运行期间从imagelist控件中读取图像名称

请帮助我...

I want to read image name from imagelist control during runtime
Kindly help me...

推荐答案

图像 属性> ImageList 的类型为 ImageCollection ,用于添加图像到这里给出的 ImageList

http://msdn.microsoft.com/en-us/library/system.windows.forms.imagelist.images(v = VS.90 ).aspx [ ^ ]

因此,无法从此系列中获取图像的名称。

System.Drawing.Image 类,在 ImageList 中使用,没有名称此处可以看到属性

http://msdn.microsoft.com/en-us/library/system.drawing.image_properties.aspx [ ^ ]

因此,一个选项是设置标记 图像的属性,然后读取所需的标记属性从 ImageList
The Images property of ImageList is of type ImageCollection and is used to add the images to the ImageList as given here.
http://msdn.microsoft.com/en-us/library/system.windows.forms.imagelist.images(v=vs.90).aspx[^]
So, as such the name of the image cannot be obtained from this collection.
The System.Drawing.Image class, which is used within the ImageList, does not have a Name property as can be seen here
http://msdn.microsoft.com/en-us/library/system.drawing.image_properties.aspx[^]
Hence, one option is to set the Tag property of Image, then read the Tag property of the required Image after retrieving it from the ImageList


for (int i = 0; i < imageList1.Images.Count; i++)
           {
               listBox1.Items.Add( imageList1.Images.Keys[i].ToString());
           }


Hi Livingstan,





图像列表中的图像没有名称,只有索引。
Hi Livingstan,


Images in an imagelist don't have names they only have an index.


这篇关于从Imagelist中读取图像名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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