windows.form c# moving between forms

和自甴很熟 提交于 2019-12-19 10:44:13

问题


I am designing an installer interface for a already written program. It is my first windows.form. I see three approaches to solving my "problem" of needing multiple "screens". I can add all the labels/buttons/interface, and then hide/show them at events. Or I can close and open a new windows? Or do I somehow load my next form into the window frame (sortv like an iFrame approach)? Can somehow help explain how to do this?

Thanks!


回答1:


Though there is nothing stopping you from using any of the approaches that you mentioned, using separate windows and opening/closing them would be cleaner. If the code for individual windows gets complicated it would be clearer if they were separate.

Since you said you are doing installer's particulary take a look at Wix. It was meant to be used for creating installer's. It has it's own approach of building UI from XML's.




回答2:


I would design my "screens" as unique frames with each frame having the controls it needed. Then I would just swap them in and out of the main window.

Its sort of like an IFrame (visually at least).




回答3:


I agree that WiX is worth a look. An alternative to WiX that some people like more (it's just different, some people like one approach, some like the other) is NSIS.

When I have a requirement that calls for swapping out the controls in a single window, I tend to create a user control for each "page".




回答4:


Have you considered using The Panel control? You can group certain controls together and have them placed inside one or more Panels.

You could Hide/Show each panel when required.



来源:https://stackoverflow.com/questions/1250350/windows-form-c-sharp-moving-between-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!