Hi John,
I'm wondering what the best practice is for creating a WinApp
"wizard" that contains 4 or 5 "steps".
I spent a lot of time working on a good solution to this and settled on the
following:
Use a single form with a TabControl on it. This is far easier than multiple
forms. Using a TabControl allows you to organise each of your "pages" easily
without having to muck around with hidden and/or overlapping panels or
anything like that. You can set the Text property for each TabPage in order
to get the name to appear in the tab header at design time, making it much
easier to know which wizard page is which.
When your form opens, set the properties of the TabControl as follows:
\\\
TabControl.Appearance = TabAppearance.FlatButtons
TabControl.Multiline = False
TabControl.SizeMode = TabSizeMode.Fixed
TabControl.ItemSize = New Size(0, 1)
///
This will cause all of the tab imagery to disappear. The tabs themselves
will now be completely invisible.
However there is one final issue. Pressing Ctrl+Tab and Ctrl+Shift+Tab will
cycle back and forth through all the tabs in the TabControl -- not what you
want, I'm sure. You can resolve this by adding the following code to your
form:
\\\
Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
Boolean
'Prevent Ctrl+Tab or Ctrl+Shift+Tab from affecting the TabControl's
selected tab
If keyData = (Keys.Control Or Keys.Tab) OrElse keyData =
(Keys.Control Or Keys.Shift Or Keys.Tab) Then
'Indicate that we've handled this keypress
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
///
(That will probably wrap badly, sorry).
This will handle all Ctrl+Tab and Ctrl+Shift+Tab keypresses within the form
and will swallow them up without doing anything.
I've used this to create several wizard form and have found it to be a very
easy and flexible way of developing such a form.
Hope that helps,