更新时间:2023-12-05 14:52:46
图像
属性> 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
TheImages
property ofImageList
is of typeImageCollection
and is used to add the images to theImageList
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.
TheSystem.Drawing.Image
class, which is used within theImageList
, does not have aName
property as can be seen here
http://msdn.microsoft.com/en-us/library/system.drawing.image_properties.aspx[^]
Hence, one option is to set theTag
property ofImage
, then read theTag
property of the requiredImage
after retrieving it from theImageList
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.