简体   繁体   English

按下按钮时如何在C#中加载新布局?

[英]How to load a new layout in C# when a button is pressed?

I want to load a new layout (just like we do in Android programming as layout1.loadLayout()) in C# when a button is pressed? 我想加载一个新的布局(就像我们在Android的程序做的layout1.loadLayout())在C#中,当按下按钮?

How can this action take place when a method is called? 调用方法时如何执行此操作?

If I am not clear in my question, I am looking to load a new set of controls and hiding the current controls temporarily on a window form when a button is clicked (while they should retain their current properties, so that if I go back they should be in the same way where I left them). 如果我不清楚我的问题,那么我希望加载新的控件集,并在单击按钮时将当前控件暂时隐藏在窗口窗体上(尽管它们应保留其当前属性,因此,如果我返回它们,应该与我离开他们的方式相同)。

How can I jump between different layouts while not completely deleting and creating them again and again? 如何在不完全删除并一次又一次地创建它们的同时在不同的布局之间跳转?

if this is for a desktop app, look into user controls. 如果是桌面应用程序,请查看用户控件。

info here 这里的信息

You could create panels to group controls and toggle it's visibility. 您可以创建面板来对控件进行分组并切换其可见性。 Look for panel control in components, then add controls to it, toogle it's visibility. 在组件中查找面板控件,然后向其添加控件,以使其可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM