I'm creating an application that has to handle the construction cases of a small company. In order for the employees to create a new case, I want to put them through a step-by-step process. How do i setup up such a process?
I've tried putting them on panels instead, but this still seams like a not so elegant way to solve this problem.
Right now i'm hiding/showing lots of textboxes and listboxes individually. Is there some smarter(more correct) wa开发者_开发技巧y to group these. Or could someone suggest another approach to this? I'm building it in c#.
The best way i have used in this scenario is to create all your Buttons, Textboxes, etc for one step in a UserControl and do the same for each step and better embed all your code specific to that step in that control itself.
On Form only keep those controls which are Universal for every Steps. Then have a container control like a Panel on the form as a Placeholder (so that you don't have to worry about positioning ..however you can even in code set the Location of the Control on Form and directly Add it to Form's Controls Collection)
Then on first step create a new instance of UserCotrol for Fisrt Step and add the first UserControl to the Forms Control Collection or that Container Control (Panel) and on next step Remove it and Replace it with Next UserControl.
This way you wont have all controls in the Memory all the Time and they will be created when required and Disposed when not required. Its Efficient and also isolate each step so you have manageable code for each step.
What about creating a Wizard for it? Hope the following links also helps you.
- What is the best way to create a wizard in C# 2.0?
- Creating Wizards for Windows Forms in C#
- Creating Wizards for Win Forms in C#
精彩评论