Is there any framework or tutorial on how to create a wizard in C#. I need to provide the user a way to do a sequence of selections/user inputs. I thought Wizards wo开发者_JAVA技巧uld be an ideal way. I need Next/Back buttons on each page. I haven't created wizards yet. Any inputs would be very helpful.
I'm working on a brief article for CodeProject on a "poor man's wizard" that uses the standard WinForms TabControl as its "foundation" : but that won't be ready for a few weeks.
But think about the advantages using the standard WinForms TabControl gives you :
"less code" == "cheap" : it will handle all the "business" suggested by Manzoor Ahmed's comment above (swapping in and out a bunch of panels), with much less code.
"no painting" == "less work" : it can be used without any special ownerdraw or painting code (the Simmons article on CodeProject cited by Jay Riggs above has some optional custom painting for gradients, but I have not examined that code in depth to see if it can be used without any custom drawing/painting). Note, of course, that Manzoor's suggestion would also not demand custom drawing/painting.
flexibility in UI : you can show the Tabs, or hide them.
Here's two ideas on how to start using the TabControl as a "wizard" :
I : how to hide the Tabs themselves if you don't want them visible (assuming a TabControl named tabControl1 on a Form named Form1) :
a. if you want to restore visibility of the Tabs : create a Form scoped variable of type Region, and in the Form Load event put the current Region of the TabControl into that variable :
Region tabOriginalRegion;
private void Form1_Load(object sender, EventArgs e)
{
tabOriginalRegion = tabControl1.Region;
}
b. add this to the Form Load event to hide the Tabs
// hide the tabs
tabControl1.Region = new Region(tabControl1.DisplayRectangle);
II : once the tabs are hidden : then, obviously you'll put your own buttons on each tab page to control forward and back movement. if the tabs are visible, then you'll want to handle the TabControl's 'Selecting event : inside that Event handler you can use e.TabPage to get the "destination" Tab, and you can cancel navigation to that "destination" tab by setting e.Cancel = true.
Hope this is useful.
I've found the DevExpress XtraWizard control to be quite nice to work with
I've used this one from CodeProject:
Wizard Form Implementation
Search CodeProject for other wizards.
Try this
C# Winforms Wizard — CodeGuru.com
Alternatively, you can use panels too. Every time you move forward or backward, just change the panels.
精彩评论