图像如何放在列表框中 [英] how image place in a list box

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

问题描述

如何使用列表框中的图像数量???

解决方案

通常,控件名为 ListBox 不是用于将图像作为项目设计的,但是您可以使用WPF进行操作,以非常明显的方式,几乎任何东西都可以放在列表框或许多其他项目控件中。



我怀疑你使用WPF;从您的评论中可以得出结论,您使用 System.Windows.Forms 。您的问题是您没有告诉我们您的意思是哪个 ListBox ;在不同的UI框架/库中存在不同的不相关控件类型,您的问题是误解了名称只有一个含义。确定,你总是应该在你的问题中指定完整的类型名称。



因此,要添加图像作为某些控件的元素,你应该考虑一些替代方案,例如:1) DataGridView DataGridViewImageCell DataGridViewImageCell 2)你的自定义控制滚动条和图像的客户区;创建一个最简单的方法是从类 ScrollableControl 派生它。



请参阅:

https:// msdn。 microsoft.com/en-us/library/system.windows.forms.datagridview(v=vs.110).aspx [ ^ ],

https://msdn.microsoft.com/en-us/ library / system.windows.forms.datagridviewcell%28v = vs.110%29.aspx [ ^ ],

HTTPS://msdn.microso ft.com/en-us/library/system.windows.forms.datagridviewimagecolumn%28v=vs.110%29.aspx [ ^ ],

https://msdn.microsoft.com/en-us /library/system.windows.forms.scrollablecontrol(v=vs.110).aspx [ ^ ]。



可以有其他一些方法来实现这一目标。



我很遗憾地说:我查看了你的所有答案,可以看出你还没有准备好问他们关于你想要学习的主题。你只是在垃圾邮件网站,现在真的知道你在问什么。我的建议是彻底阅读技术,并教育自己达到可以提出真正帮助你的问题的水平。此外,你需要学会充分了解你的询问者的位置,更明确和建设性地接受批评,并积极接受批评。



-SA


尝试:

 Console.WriteLine(myListBox.Items.Count); 


How can the number of images in a list box that can be used ؟؟؟

解决方案

Normally, the controls called ListBox are not designed for putting images as items, but you can do it with WPF, in quite an apparent way, nearly anything can be put in a list box or many other items controls.

I doubt that you use WPF; from your comments, it can be concluded that you use System.Windows.Forms. Your problem is that you don't tell us which ListBox you mean; there are different unrelated control types in different UI frameworks/libraries, your problem is the misconception that there is only one meaning of the name. To be certain, you always should specify full type name in your questions.

So, to add images as elements of some controls, you should consider some alternatives, such as: 1) DataGridView with DataGridViewImageCell and DataGridViewImageCell 2) your own custom with control a scroll bar and a client area for images; the simplest way to create one would be deriving it from the class ScrollableControl.

Please see:
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewimagecolumn%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.scrollablecontrol(v=vs.110).aspx[^].

There can be a number of other ways to achieve that.

I'm sorry to say: I looked through all your answers and can see that you are not yet prepared to ask them on the topics you are trying to learn. You are just spamming the site, now really knowing what you are asking about. My advice is to read thoroughly on technology and educate yourself to the level where you can ask question which could really help you. Also, you need to learn to talk to people adequately to your position of an inquirer, more clearly and constructively, and accept criticism positively.

—SA


Try:

Console.WriteLine(myListBox.Items.Count);


这篇关于图像如何放在列表框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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