I am creating a program which has an installer-like interface. Is it better to implement it with ShowDialog
method of Form
class or doing an MDI interface? Below are the ways I tried to do it using the ShowDialog
method, and the problems I have with 开发者_JS百科them:
1) First form ShowInTaskbar
property is set to true
, other form is set to false
. Form is shown by .ShowDialog()
method in response to button "Next>"
click event, click event of "<Back"
button invokes .Close()
method. In this case forms appear in modal mode, it's bad experience for me.
2) All forms have ShowInTaskbar
property set to true; form is shown by .ShowDialog()
method in response to click event of button "Next>"
(same event handler sets .Visible=false
to hide the form); on click event of "<Back"
button invoke .Close()
method. In this case when pressing Next
or Back
closing and opening a new window is visible in the in the task bar.
Usually wizard-type interfaces are implemented by having one window (Form
) and replacing its content on Next
/ Back
buttons press.
It's a bit confusing what UI framework you are using, as you tagged your question with Visual C++ which would suggest MFC, ATL/WTL or Win32, but you also tagged it with .Net and the methods and properties you are mentioning suggest WinForms.
If you are using WinForms, the easiest way would be to create several Panel
instances on your your form that contain the groups of controls you currently have on the different forms and just show/hide the right Panel
depending on which button was pressed and what is the previous visible Panel
.
An alternative would be to use the TabControl
with hidden tab buttons and just change the selected tab on button press.
A blog post that provides some sample implementation of a generic wizard control.
And an old thread on social.msdn.com that discusses the wizard dialog problem and the various approaches to it, along with some more useful links to more implementations.
And DevExpress have a commercial Wizard control if you have a budget for components and want to save some time and efforts.
精彩评论