如何在列表框中放置一个按钮。 [英] How to put a button inside a listbox.

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

问题描述

我正在搜索如何在列表框中放置一个按钮。目的是关闭列表框。如果没有,在文档点击我想关闭列表框。

任何人都可以指导我。

解决方案

完全没有意义。另请参阅我的评论。 关闭的整个概念是未确定的。应该发生什么,确切地说?



可能,列表框可​​能会消失,其位置将被其他一些控件占用。但即使你有这样的设计,也不要放一个按钮。没有普通用户需要关闭按钮,尤其是内部控件本身。如果环顾四周,你会发现根本就没有这样的比喻。即使是窗户(窗体)也不会被其所在地区的东西关闭。仔细观察:它被一个位于窗口非客户区的按钮关闭。



所以,你可以做类似的事情,行为的预期方式。将列表框(或多个控件)放在视觉上分离的面板(边框,颜色)上,并在此面板的右上角有一个小的交叉框按钮。只有在这种情况下,用户才会立即看到该做什么。



更好的是,根据UI元素的删除来检查设计,设计一些更常见的东西。一个典型的建议是 TabControl 。在不知道您的详细信息的情况下,我无法提供任何具体建议。



-SA


您无法关闭ListBox,因为它是表单上的控件。虽然如果你想在ListBox上放一个按钮,我会使用ListView,因为它可以包含所描述的自定义列类型这里 [ ^ ]。

I am searching a lot to find how to put a button inside listbox. The purpose is to close the listbox. If not , on document click I want to close listbox.
Can any one guide me.

解决方案

Makes no sense at all. Please also see my comment. The whole notion of "close" is something undetermined. What is supposed to happen, exactly?

Probably, the list box can disappear, and its place will be taken by some other controls. But even if you have such design, don''t put a button. No normal user expects a "Close" button, especially insider the control itself. If you look around, you will see that there is no such metaphor at all. Even a window (form) is not closed by something in its area. Look thoroughly: it is closed by a button which is in the window non-client area.

So, you can do something similar, the way the behavior is expected. Put your list box (or a number of control) on a visually separated panel (borders, color), and have a small crossed-box button in the right top corner of this panel. Only in this case the user will immediately see what to do.

Better yet, review the design based on removing of UI elements, design something more usual. One typical suggestion would be the TabControl. I cannot give any specific advice without knowing your detail.

—SA


You cannot close a ListBox as it is a control on the form. Although if you want to put a button on a ListBox I would use a ListView as it can contain custom columns types as described here[^].


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

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