ImageList和PictureBox问题 [英] ImageList and PictureBox question

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

问题描述

根据我在MSDN上的解释,ImageList中的图像必须都是相同的大小......这是正确的吗?



我正在尝试使用一个ImageList来存储不同大小的图像,所以我可以在PictureBox中使用它们,但图像是扭曲的...所以我认为我不能用这种方式使用这两个组件。



是否有一个组件可以存储我的图像,然后将它们拉入PictureBox?



谢谢...

解决方案

你是对的, ImageList 的图像应该具有相同的大小和其他特征。出于您的目的,此课程不适合。您应该使用类 System.Collections.Generic.List< System.Drawing.Image> 或...只是一个类型 System.Drawing的数组.Image []



-SA


是的,你可以使用:



 List< Image>图像; 





或字典或任何其他通用集合。


因为我确实有对PictureBox的简单使用,我能够通过将几个图像加载到PictureBox资源列表中然后以这种方式访问​​代码所需的图像来解决这个问题:



< pre lang =c#> syncJobPictureBox.Image = Properties.Resources.ftp140x149;





感谢所有回复的人。


From what I interpret on MSDN, the images in an ImageList must all be the same size...is this correct?

I'm trying to use an ImageList to store images of different sizes so I can use them in a PictureBox but the images are distorted...so I don't think I can use these two components this way.

Is there a component that I can store my images in and then pull them into a PictureBox?

Thanks...

解决方案

You are right, the images of the ImageList should be of the same size and other characteristics. For your purpose, this class is not suitable. You should rather use the class System.Collections.Generic.List<System.Drawing.Image> or… just an array of the type System.Drawing.Image[].

—SA


Yes, you can use:

List<Image> images;



Or a Dictionary, or any other generic collection.


Because I do have a simple use for the PictureBox, I was able to solve this by loading several images into the PictureBox resources list and then accessing the needed image in code this way:

syncJobPictureBox.Image = Properties.Resources.ftp140x149;



Thanks to all of you who replied.


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

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