在Windows窗体中隐藏和显示控件?: [英] Hide and Show Control in Windows Forms?:

查看:332
本文介绍了在Windows窗体中隐藏和显示控件?:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有MdiParent Form的窗口表单应用程序和菜单条中的一些选项,例如

详细数据输入和重要数据输入。我在这里做了什么我首先做了一个简单的数据输入表格,现在我想要从菜单条中选择详细数据输入选项它显示的完整数据输入,当我选择其他一个选项时(重要数据输入)它显示相同的表格,但隐藏额外的详细信息 选项并且仅显示基本详细信息。



帮我解决这个问题...





谢谢



问候

Ashish Dhiman

解决方案

我建​​议您使用 TableLayoutPanel 用于设计表单的容器。这将允许你做你想做的事。

你可以根据需要将Visible属性设置为True / False。



目前,当您从表单中隐藏某些控件时,它将是该位置的空白区域。但是当你使用 TableLayoutPanel 并设置自动调整行/列时,它将被折叠并填充控件之间的空格。



您可以参考以下链接:

http:// www .programcall.com / 28 / csnet / winform-tablelayout-panel.aspx [ ^ ]



http://www.c-sharpcorner.com/uploadfile/mahesh/tablelayoutpanel-in-C-Sharp/ [ ^ ]


这是一个想法:谁需要MDI?为什么要折磨自己并吓跑你的用户?

帮自己一个大忙:根本不要使用MDI。没有它,您可以更轻松地实现设计,质量更好。 MDI甚至被微软高度劝阻,事实上,微软将其从WPF中删除并且很难支持它。更重要的是,如果您使用MDI,您将吓跑所有用户。只是不要。请参阅:

http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages [ ^ ],

如何在WPF中创建MDI父窗口? [ ^ ]。



我可以解释做什么。请看我过去的答案:

如何在WPF中创建MDI父窗口? [解决方案2 ],

关于在WPF中使用MDI窗口的问题 [ ^ ],

麦当劳给出错误 [ ^ ],

如何设置子窗体最大化,最后一个子窗体最小化 [ ^ ]。



-SA

I have a window form application with MdiParent Form and some Option in menu strip like
Details Data Entry and Important Data Entry. What i did in this i make a simple Data Entry Form first and now i want when i select Details Data Entry Option from Menu Strip it shows full Data Entry From and when i choose other one option (Important Data Entry) it shows the same form but Hide the Extra Details Option and Only Shows Essential Details.

Help me to sort Out This Problem...


Thanks

Regards
Ashish Dhiman

解决方案

I suggest you to use TableLayoutPanel container to design your form. This will allow you to do what you want to do.
You can set Visible property to True/False as required.

Currently, when you hide some controls from your form it will be blank space at that location. but when you use TableLayoutPanel and set row/columns autosized, it will be collapsed and fill the blank spaces between controls.

You can refer below links :
http://www.programcall.com/28/csnet/winform-tablelayout-panel.aspx[^]

http://www.c-sharpcorner.com/uploadfile/mahesh/tablelayoutpanel-in-C-Sharp/[^]


Here is the idea: who needs MDI, ever? Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don''t. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
How to Create MDI Parent Window in WPF?[^].

I can explain what to do instead. Please see my past answers:
How to Create MDI Parent Window in WPF? [Solution 2],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].

—SA


这篇关于在Windows窗体中隐藏和显示控件?:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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