显示/隐藏细节的WinForm [英] Show/Hide details WinForm

查看:191
本文介绍了显示/隐藏细节的WinForm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个WinForm应用程序(.NET3.5),我展示了一些客户的详细信息。我的问题是,我们有一个方向字段关联到一个地址。为了节省空间,我想有隐藏,直到用户希望看到他们的方向。我的意图的方法是有一个手风琴像presentation的方向。
我想我也能做到这一点的,隐藏字段和 BringToFront()的(这会不会更好)。

I am creating a WinForm App(.net3.5) where I display some Client Details. My issue is that we have a directions field that correlates to an Address. To save room I would like to have the directions hidden until the user "wishes" to see them. My intended method was to have an "accordion" like presentation for the directions.
I would imagine I could also do this with a hidden field and BringToFront()(would this be better).

有人可以提供对手风琴风格的一些指导?
事情是否已经存在?
我是否需要采取任何特殊的考虑?
在编码我自己的行为;我会继续前进都记录下来,然后备份等?

Can someone offer some guidance on the Accordion Style?
Does something already exist?
Do I need to take anything special into account?
In coding my own behavior; Would I just move everything down and then back up etc?

谢谢!

推荐答案

当我需要这种类型的行为,我发现的TableLayoutPanel 是有用的。如果持有可扩展的内容可以设置的行和列自动调整大小 - 这样一来,当你隐藏的内容,该行崩溃

When I require this type of behaviour, I find that the TableLayoutPanel is useful. You can set the rows and columns to auto-size if holding expandable content - that way, when you hide the content, the row collapses.

如果你再有另一个控制(一个按钮,例如),你可以用它来控制扩展内容的隐藏状态。

If you then have another control (a button, for example), you can use that to control the hidden state of the expandable content.

例如,创建一个3行1列的表格。加一个固定的大小按钮,在顶部,以及在中间的自动调整大小的元素。请比例大小的最后一行(你需要这个,这样的东西需要的剩余空间时,中间行的大小为零)。然后使用您的按钮来改变任何你中间行的Visible属性。

For example, create a 3 row, 1 column table. Add a fixed size button at the top, and an autosize element in the middle. Make the last row percentage-sized (you need this so that something takes the remaining space when the middle row sizes to zero). Then use your button to change the visible property of whatever you have in the middle row.

这篇关于显示/隐藏细节的WinForm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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