windows.form c# moving between forms

2019-02-20 11:05发布

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!

4条回答
Juvenile、少年°
2楼-- · 2019-02-20 11:32

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楼-- · 2019-02-20 11:48

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楼-- · 2019-02-20 11:50

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.

查看更多
兄弟一词,经得起流年.
5楼-- · 2019-02-20 11:53

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.

查看更多
登录 后发表回答