CodeProject: Designer centric Wizard control....

来源:百度文库 编辑:神马文学网 时间:2024/04/30 20:33:51

5,297,984 members and growing! (22,851 online)fengtoprojectcode |My Settings |My CodeProject | My Bookmarks |My Articles |Sign out
Home   Current Site:Main SiteJavaLinux Apache MySQL PHP  Help!ArticlesMessage BoardsJob BoardLounge
Desktop Development »Miscellaneous »Miscellaneous Controls     Intermediate
Designer centric Wizard control
ByAl Gardner
A Wizard control designed for design time development. C#, Windows, .NET 1.0, .NET 1.1, .NETVS, VS.NET2002, VS.NET2003, Dev
Posted: 6 Sep 2004
Updated: 16 Dec 2004
Views: 159,834
Announcements
Summer Code Competition!
New thawte Scavenger Hunt!
Win CodeProject Coffee!
Monthly Competition
Want a new Job?
.NET Software Developer / Engineer at Manticore Technology in United StatesProduct Planner, Visual Studio at Microsoft in United StatesProduct Manager: Visual Studio Web Development at Microsoft in United StatesView Latest Jobs...
Chapters
Desktop Development
Button Controls
Clipboard
Combo & List Boxes
Dialogs and Windows
Desktop Gadgets
Document / View
Edit Controls
Files and Folders
Grid & Data Controls
List Controls
Menus
Miscellaneous
Printing
Progress Controls
Selection Controls
Shell and IE programming
Smart Client
Splitter Windows
Static & Panel Controls
Status Bar
Tabs & Property Pages
Toolbars & Docking windows
Tree Controls
Web Development
Ajax and Atlas
Applications & Tools
ASP
ASP.NET
ASP.NET Controls
ATL Server
Caching
Charts, Graphs and Images
Client side scripting
Custom Controls
HTML / CSS
Internet / Network
ISAPI
Site & Server Management
Session State
Silverlight
Trace and Logs
User Controls
Validation
View State
WAP / WML
Web Security
Web Services
Enterprise Systems
Content Management Server
Microsoft BizTalk Server
Microsoft Exchange
Office Development
SharePoint Server
Multimedia
Audio and Video
DirectX
GDI
GDI+
General Graphics
OpenGL
Database
Database
SQL Reporting Services
Platforms, Frameworks & Libraries
ATL
MFC
STL
WTL
COM / COM+
.NET Framework
Win32/64 SDK & OS
Vista API
Vista Security
Cross Platform
Game Development
Mobile Development
Windows CardSpace
Windows Communication Foundation
Windows Presentation Foundation
Windows Workflow Foundation
Libraries
Windows Powershell
LINQ
Languages
C / C++ Language
C++ / CLI
C#
MSIL
VBScript
VB.NET
VB6 Interop
Other .NET Languages
XML
Java
General Programming
Algorithms & Recipes
Bugs & Workarounds
Collections
Cryptography & Security
Date and Time
DLLs & Assemblies
Exception Handling
Localisation
Macros and Add-ins
Programming Tips
String handling
Threads, Processes & IPC
WinHelp / HTMLHelp
Graphics / Design
Expression
Usability
Development Lifecycle
Debug Tips
Design and Architecture
Installation
Work Issues
Code Generation
General Reading
Book Chapters
Book Reviews
Hardware Reviews
Interviews
Scrapbook
Hardware & System
Third Party Products
Product Showcase
Solution Center
Services
Job Board
Code Project Coffee
Free Magazines
Feature Zones
IBM DeveloperWorks
WhitePapers
Code Generation
Quest SQL Zone
Search   Articles Messages Jobs   Advanced Search
Sitemap |Add to IE Search
Print  Report Article  Watch  Bookmark  Discuss   Send to a friend
109 votes for this Article.
Popularity: 9.78 Rating: 4.80 out of 5

1
2
3
4
5
Download source - 59.7 Kb

Introduction
There are many wizard controls out there:Wizard Control,.NET Wizard control, and of course themagic library. Here's another one, that might meet your needs when others don't.
Background
Last year, I was writing an application that needed a wizard control. I looked around and found none of the controls quite suited my needs, and so I wrote my own. However, following the loss of both the working source code and the CVS tree, I now found myself re-writing from scratch something I have already done once before. The advantage with this method is that my prototype really looked into every single problem that I could have encountered beforehand, and I believe I am left with a nice, neat, and clean result.
It comes in three controls, the first Wizard handles all the functionality of the wizard, and provides a collection of WizardPages that you can author upon. Pressing the Back and Next buttons moves through the pages as you would expect (even at design time).
In order to provide the correct look, two additional controls are provided, InfoPage and Header. These take the correct colors from the System.Colors namespace and render the expected Wizard look in lightweight and simple controls. This approach means the GUI can be customized by inheriting or implementing entirely separate controls, and of course, these controls can provide the UI in other forms of your application without needing to use a Wizard control.
One very important point to remember with Wizards is that they are supposed to support a single task and make it easy for an user. It is very easy to add extra features into a Wizard when actually you should split your task into multiple Wizards. Consider that a Wizard can be used to create/edit an object, but not delete it.
v1.1 of this Wizard adds another feature that can be used badly. This is the provision of multiple Finish pages (see below). A Finish page is usually a text only summary of what will happen after Finish is pressed, a last chance to change your mind; however, it can be easier to build this summary on a separate page and have a unique back path.
Using the code
I have subsequently reused this code in several applications; you can either create a DLL or copy it into the same project, whichever your preference.
If you move the code out of the project it is in, you will get three compilation errors:
The type or namespace name 'ParentControlDesigner' could not be found (are you missing a using directive or an assembly reference?).
These can be easily fixed by adding a reference in the project to the System.Design.dll.
Design Time Features
First, let's have a look at the pretty stuff, via the designer. We will come to real code, event hookup, and manually calling methods, later.
Adding the Wizard to a Form

Once compiled, three controls will be added to your toolbox in user controls. If they don't appear, then you may simply need to open each of them in design mode.
Start by adding a Wizard control to your form. This one shown below is as dropped on the form and has not been docked or anchored into the form yet.
Please note after first adding that you do not have a control surface to add controls to (as indicated by the lack of a grid inside the control).

Once the page has been added, either change the Docked property to Full or set the Anchors, Size and Position via the Wizard properties.
Adding Pages to the wizard

In order to add pages, go to the Pages property and click the ellipsis (...) button. This opens the Collection editor which can be used to add pages to the collection. The example comes with three pages already added.
While writing this article, I realize I have not implemented the AddTab and RemoveTab verbs for the control. Since a WizardDesigner is already implemented in this solution, the addition of the verbs and the tying up of the events should be a relatively small piece of work which I shall post up shortly.
Each WizardPage is an overridden Panel control, so any other Windows Control can be dropped straight onto the WizardPage. This allows you to build up complex Wizard interfaces as you may require; however, this control is currently lacking the standard look of a Wizard as you know it.
Defining a Finish Page
The final page of the Wizard will always be a Finish Page. This means that the Next button will display the word "Finish" and clicking this will return a DialogResult.OK.
Should you design a Wizard that requires multiple different Finish Pages, then additional pages can also become Finish Pages by setting IsFinishPage=true on the desired WizardPage.
Adding a Wizard Look

The remaining three controls are now used to add the correct look to the Wizard. Start and End pages within the Wizard are handled by using either an InfoPage or InfoContainer control.
The InfoPage contains a full height right docked image, a title and a section of descriptive text. It does not easily support contained controls. The main properties of interest are Image, PageText, and PageTitle. Image takes an image that is the same size as the left image standard system Wizard, i.e., it is 164 pixels wide. However, should your Form be taller than the image, it will repeat at the bottom. An example image (wizBigOnlineFolder.gif) is included in the project in order that you modify it. PageTitle is the text which appears in the title section, and PageText is that which appears below.
The InfoContainer is very similar to InfoPage but only shows a title and image. At its name suggests, it supports contained controls at design time and therefore allows any combination of controls to be added to build up your initial/final page. If the form is Sizable, then I would advise that attention is paid to correctly anchoring contained controls, and that RichTextBoxes with BorderStyle=None, ReadOnly=true, Background=White, and Scrollbars=Vertical are useful instead of labels where a possibly large piece of text is needed to be displayed.

The Header is used at the top of every WizardPage that does not include an InfoPage. Once again, the interesting properties are the Image, Title, and Description. Image will resize if possible to best fit the image in. Title is shown in larger font, and Description the smaller font below.
Both of these controls resize, while attempting to be as accurate to the Wizards used in Windows XP as possible.
Code Features
This section focuses on the Wizard control as the others are really only GUI placeholders.
Events raised during Wizard operation
In order to allow the most complicated Wizards to be facilitated, there are five events that are thrown by the Wizard, four from the WizardPage and one from the wizard control.
The wizard control throws an event whenever somebody clicks the Cancel button. If you decide to prevent the Close of the Wizard, then set the Cancel of the CancelEvent to true.
/// /// Called when the cancel button is pressed, before the form is /// closed. Set e.Cancel to true if /// you do not wish to close the wizard. /// public event CancelEventHandler CloseFromCancel;
Pressing Next or Back, however, raises two events from the WizardPage, one to close the existing page and another to open the new page.
/// /// Event called before this page is closed when the back button is /// pressed. If you don't want to show the next page then set /// e.page to be the new page that you wish to show /// public event PageEventHandler CloseFromBack; /// /// Event called before this page is closed when the next button is /// pressed. If you don't want to show the previous page then set /// e.page to be the new page that you wish to show /// public event PageEventHandler CloseFromNext; /// /// Event called after this page is shown when the back button is pressed. /// public event EventHandler ShowFromBack; /// /// Event called after this page is shown when the next button is pressed. /// public event EventHandler ShowFromNext;
As you can see, the Closing events pass a more complex eventArgs. The Closing events allow you to override the Next or Previous Page that will be shown after this Page closes. The PageEventArgs provides you with the option of setting the following Page via either its index (this is not advised for safe code however) or by passing a WizardPage itself.
/// /// Arguments passed to an application when Page is /// closed in a wizard. The Next page to be displayed /// can be changed, by the application, by setting /// the NextPage to a wizardPage which is part of the /// wizard that generated this event. /// public class PageEventArgs : EventArgs { /// /// Gets/Sets the wizard page that will be displayed /// next. If you set this it must be to a wizardPage /// from this wizard. /// public WizardPage Page [..] /// /// Gets the index of the page /// public int PageIndex [..] } Page Validation
The CloseFromBack/CloseFromNext events give the developer a final chance to validate each control on the WizardPage. Ideally, you have already used an ErrorProvider to indicate to the User the problems with validation on each control, but during this event, you can double check the values and allow or deny the move to the next WizardPage.
private void wpLogin_CloseFromNext(object sender, Gui.Wizard.PageEventArgs e) { if ( == true && == true) { //All successful, do nothing } else { //Tell the user Why MessageBox.Show(“Failed Validation”); //Stay on the correct page e.Page = wpLogin; } }
N.B.: I find that writing the logic to check for success is easier to read than checking for a fail. You are free to use DeMorgans Theorem and reverse this to check for a fail should you wish.
Controlling the Wizard Buttons
The Wizard also has the ability to enable or disable its buttons depending on your requirements. Since the state of these are expected to change with each page, the state is not saved as part of the design process. They will always default to enabled, and you have the option of disabling them in each Show event for the page.
/// /// Gets/Sets the enabled state of the Next button. /// [Category("Wizard")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool NextEnabled [..] /// /// Gets/Sets the enabled state of the Back button. /// [Category("Wizard")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool BackEnabled [..] /// /// Gets/Sets the enabled state of the Cancel button. /// [Category("Wizard")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool CancelEnabled [..]
The second page of this example code attempts to demonstrate this with the well known License agreement page. The only code added to the form is as follows:
private void wizardPage2_ShowFromNext(object sender, System.EventArgs e) { wizard1.NextEnabled = checkBox1.Checked; } private void checkBox1_CheckedChanged(object sender, System.EventArgs e) { wizard1.NextEnabled = checkBox1.Checked; } Non-Wizard behavior processing
Finally, there are four methods that have recently been added to the Wizard. Next() and Back() simply allow a programmatic means of going to the following or previous pages respectively. These methods step outside the normal processing of the wizard, so if you can achieve the results you desire via the above methods, I advise you to do so.
Slightly more dangerous are NextTo(WizardPage) and BackTo(WizardPage). These methods skip raising the WizardPage Close event, which of course means that your validation is not performed. My reasoning for this is because the Close event allows you to specify which page you want to go to. So, if you first tell the Wizard to display a particular page via a call to NextTo(), and the closing event was called and informs the Wizard to go to a different page, which page should I go to? I have assumed that, as the coder, we understand enough to validate first and only then call NextTo or BackTo. An example of this is included in the penultimate page in the demonstration project.
Given, I am issuing the above warning, why should I wish to release these additional methods out to the wild? Well, they solve a couple of unusual circumstances.
The Perform Processing Page and Next() example
On occasions, you wish to display a Wizard page and have it perform processing. When the processing is done, you may wish to change to the next page automatically. (I have unfortunately seen users watch a progress control complete, and then leave a screen sitting there that says 'Press Next to continue...'.)
See the example on the third page of the Wizard to see this in action. (N.B.: the use of the timer is not a very good way of performing processing in the Wizard and receiving updates, but it was simple to code for this example.)
The Button to jump around the Wizard
The final example page has several buttons that allow you to directly access pages in a Wizard. 99% of the time, this can be avoided by setting the Page property of the Close event, and I urge you to do so. Please note the difference between using NextTo and BackTo compared to any other movement.
One (bad) example where this is of use is, if you are using a Wizard to build a new object and you have to choose something, where different choices then lead to different pages. (It's not a good thing to do, as you have to work out how to navigate back to the correct pages too. Instead, it's better to have one new Form/Wizard to handle selecting which type of object we want to handle, and another Wizard to perform the operation on that Wizard, just like Add Printer in Windows 2000+).
Points of Interest
Using the collection editor
Adding pages caused many problems. The implementation of the PageCollection and capturing the events is vital in order to work with the VS.NET Collection Editor. If you fail to catch the events, you end up with Controls that do not get correctly added to the form and frequently are valid only in the code.
Detecting the Next and Back buttons at design time
This also caused many problems and had several work-arounds until I looked at the code behind the other alternative Wizards listed at the start of the article. Thanks go to the authors of these examples (and many others) posted on CodeProject.
Update (v1.1)
This has now been rewritten from scratch. Have a look at the WizardDesigner for the full code, but it basically works by overloading the ControlDesigner.GetHitTest to detect where the buttons are, and allow MouseDown and MouseUp events to be generated.
protected override bool GetHitTest(Point point) { Wizard wiz = this.Control as Wizard; if (wiz.btnNext.Enabled && wiz.btnNext.ClientRectangle.Contains(wiz.btnNext.PointToClient(point))) { //Next can handle that return true; } if(wiz.btnBack.Enabled && wiz.btnBack.ClientRectangle.Contains(wiz.btnBack.PointToClient(point))) { //Back can handle that return true; } //Nope not interested return false; }
In the Wizard, we then add handlers for MouseDown on btnBack and btnNext and which only work in DesignMode.
private void btnBack_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e) { if (DesignMode == true) Back(); } History
v1.1 - 15th Dec 2004. Rewrote to better use Designer features. Now uses GetHitTest instead of WndProc. Verified to be compatible with SharpDevelop by user Validate. v1.0.1 - 9th Dec 2004. Added multiple finish pages. Not released to CodeProject. v1.0 - 15th Nov 2004. Considered stable. (10,000+ page views, 4.54 rating). Update with InfoContainer, and validation to prevent controls in Wizard (instead of pages) as suggested by user vbnetuk. v0.1b - 7th Sep 2004. Fixed the description of Next, NextTo, Back, BackTo, and added the main picture. V0.1a - 6th Sep 2004. Initial release.
License
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be foundhere
About the Author
Al Gardner

** Apologies but my daughter was born in October 2004, and so coding now comes second. My reponses tend to take a lot longer**
I've been coding since I got my first ZX Spectrum. From Basic to assembly, through C,C++ and arriving at C#. On the way I've throughly enjoyed Perl, Lisp and XML.
I find I can make the intellectual leap to understand the problem, I love big picture designs, patterns and reuse. I may be addicted to abstract classesGOF has a lot to answer for. I miss delete() even though I spent too much time finding the leaks.
My favourite part of coding is in UI design because of the complexity, the event driven nature, and the fact its (virtually) tactile. I hate GUI's that don't follow system guidelines, don't resize, and don't display properly when you change system colour and font.
Occupation: Software Developer (Senior)
Location:United Kingdom
Other popular Miscellaneous articles:
MFC Grid control 2.26 A fully featured MFC grid control for displaying tabular data. The grid is a custom control derived from CWnd
Themed Windows XP style Explorer Bar A fully customizable Windows XP style Explorer Bar that supports Windows XP themes and animated expand/collapse with transparency.
TaskbarNotifier, a skinnable MSN Messenger-like popup in C# and now in VB.NET too The TaskbarNotifier class allows to display an MSN Messenger-like animated popup with a skinned background
CPPToolTip v2.1 A class that allows you to display your data for a control as tooltip
Formula Editor Formula-editor for editing and exporting mathematical content
Add this article to:
Article TopRate this Article for us!   Poor
Excellent

 FAQ  Noise Tolerance Very High High Medium Low Very Low Search Messages
Layout Normal Expand Root Messages Expand All Messages Thread View No Javascript (slow) No Javascript Preview    Per page 10 25 50

New Message Msgs 1 to 25 of 189 (Total in Forum: 189) (Refresh) FirstPrevNext
Subject   Author  Date

Disabling Back button on last pageTalha Ekram 1:31 4 Jun '08
Is there any i can disable back button on the last page, as finish button does not retain the current form and closes it once clicked.
I have used this for conditional disabling of button but it does nt worked.
wizard1.BackEnabled = false;
I dont want the user to repost the successful record again.
Talha Rulz
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Thank you! It is very useful and easy to understand all capbilities of the control.vasiliev.maxim 2:23 15 May '08
Thanks
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

How to change the last page button name Finish to some other name?karthikeyanxiotech 6:35 26 Apr '08
Hi can any one help me,here i need to change the name of the button Finish to "Create" at the last wizard page is it possible?
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Re: How to change the last page button name Finish to some other name?leggan 10:37 5 May '08
I did it for my use (changed all buttons to Norwegian) by adding four new properties to the wizard.cs code.
So you can do the same to change the FinishText.
NextText
BackText
CancelText
FinishText
The only trick inside wizard.cs part was to handle that the Next button toggles between "Next >" & "Finish"
Then in my form in the Wizard1_Load I set these properties
Reply·Email·View Thread·PermaLink·Bookmark 4.00/5 (1 vote) Rate this message:12345

Re: How to change the last page button name Finish to some other name?karthikpoy 10:43 5 May '08
Thanks for your reply leggan, i will modify the code as you mentioned above.
Thanks
--Karthik.
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Vista UI Updatecraig22033 12:05 3 Apr '08
Has anyone heard of an update for Vista and the GUI standards. I saw a post from a while ago about an update, but that was last year. This is a excellent control! Good Work!!
Thanks!!!
Craig
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Re: Vista UI UpdateAl Gardner 13:22 7 Apr '08
I'm literally in the middle of putting together an installer and I will have a Vista Compatible wizard available. It follows the Aero UI standards and falls back to current design if run on XP or before.
In addition I have a couple of additional controls that support Glass and most other Vista Dialog controls. Send me an email if you would like to have a preview, and help iron out the kinks.
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Re: Vista UI Updatecraig22033 18:48 7 Apr '08
Al Gardner wrote:
Send me an email if you would like to have a preview, and help iron out the kinks
That sounds cool!! I would be happy to preview it and help work some kinks. You can use craig22033@yahoo.com.
Thanks!
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Re: Vista UI Updateb0bi 9:22 23 Apr '08
And to me please. b0bi79@gmail.com
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Re: Vista UI UpdateJohn Osborn 10:03 16 May '08
Thank you for a GREAT control!!!
One thing that I almost always end up implementing when creating a wizard is a breadcrumb feature so that I can avoid implementing reverse logic and more easily trace my steps back. It is easy to implement by pushing pages onto a stack as I move forward through the wizard, and then popping them off the stack to exactly retrace my steps. You might consider building this feature into your wizard.
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Finish button CloseFromNext event ignores e.PageIndexThe_Mega_ZZTer 23:54 2 Apr '08
If you change e.PageIndex in the last page's ClosefromNext event, the wizard still closes the app when clicking Finish. Expected behavior would be to move the wizard to the set page instead, IE if the user checks a "Run this wizard again to do this on more files etc" option.
Of course this could be a glitch I introduced when I translated it to VB.NET, but it was largely automated so I don't think so.
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

how to install it?debussyster 22:31 6 Jan '08
I have done as you said to build the demo project,but there is no any dll generated?I use vs2005,your net 2.0 version could not be download.
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Thanks!Pedro Barreto 13:10 5 Dec '07
Thanks for this great piece of code.
It's the best and simplest wizard implementation I've seen.
Pedro
Reply·Email·View Thread·PermaLink·Bookmark 5.00/5 (1 vote) Rate this message:12345

PageCollection IncludesRyan Lovelett 21:10 8 Nov '07
The type or namespace name 'PageCollection' could not be found (are you missing a using directive or an assembly reference?)
I added the System.Design.dll and I'm still having this issue. Any help would be appreciated.
Thanks,
Ryan
Reply·Email·View Thread·PermaLink·Bookmark 5.00/5 (1 vote) Rate this message:12345

LicenseCunobaros 6:15 24 Oct '07
Thanks for this eminently useful component. I'd like to use it in a commercial application I'm writing for the company I'm working for, and as I can't find any copyright or license notes in the code, I assume that the standard CodeProject terms apply.
I wonder, though, if you'd like to be credited in the documentation, and if you would mind if I put a link to this page and you name in the files before submitting them to our internal repository?
Something simple, like this:
/// Copyright 2004 Al Gardner
/// http://www.codeproject.com/cs/miscctrl/DesignTimeWizard.asp
at the head of every file, so it's obvious to any developer coming after me (should I leave or transfer to another project) where it's from and who wrote it.
Reply·Email·View Thread·PermaLink·Bookmark 3.00/5 (2 votes) Rate this message:12345

Re: Licenseradialronnie 17:28 11 Mar '08
Seconded. I also would like to use this in a commercial application and could'nt find any license notes.
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Best control I ever used in Code Project.derekliang 12:23 15 Oct '07
It saved many hours of work for one of my projects and I will commend to anyone who would like to implement wizard control for their applications.
Thank you for sharing with us.
Reply·Email·View Thread·PermaLink·Bookmark 2.00/5 (1 vote) Rate this message:12345

Using in VS2005 Toolbox (bug workaround)Todd-Lucas 11:35 14 Oct '07
I thrashed for quite a while on this, only to discover that it's a bug in VS2005. The bug is that you can't add items to the toolbox if they're in a Project that is part of a Solution.
I know I know...this is a rare corner case. Why would anyone want to do that? Well, some people do, including me. If you're one of the poor b*stards who happen to try, you'll bang your head against the wall until you either realize it's a bug or find this post.
Here are two links containing a plethora of pleading plebeians. The problems are marked as Closed, but apparently you'll need VS2008 to see it.
Feedback: User control doesn't show in toolbox if the project is under solution folder
Feedback: User Controls do not show up in toolbox
(I appologize for the rant, but I had to vent a little.)
Anyway, the workaround is this.
1. Create a new project of type Visual C# / Windows / Windows Control Library. You can even add it to your solution, if you like.
2. Copy the contents of the Wizard folder in the sample to the project directory.
3. Right-click on the project in Solution Explorer, select Add / Existing Item... and select all of the newly copied files.
4. Build the new project.
5. If the Toolbox is not visible, select Toolbox from the View menu or Ctrl+Alt+X.
6. [optional] Right-click on the Toolbox, select Add Tab, and type a name (I chose My User Controls, like Al has in the article).
7. Right click on the tab under which you would like to add the controls and select Choose Items...
8. On the main tab (.NET Framework Components) select the Browse... button and navigate to the build output directory of the new project (e.g., ProjectName\bin\Debug) and select the assembly DLL.
9. All of the appropriate controls should be automatically selected in the list, so you should be able to click OK and see the following items in the list: Header, InfoContainer, InfoPage, WizardPage, and Wizard.
If anyone has any additional info or workarounds, please post as a follow up. Thanks and good luck.
- Todd
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Re: Using in VS2005 Toolbox (bug workaround)Al Gardner 14:51 14 Oct '07
Todd,
I'm not quite sure what your problem is here.
- I've never had any problems with using controls from projects inside a solution. I do it all the time.
- There are known VS2005 issues with using controls from projects inside a solution folder inside a solution.
Glad to see you've investigated it and detailed the VS workaround, but there is nothing I can do with this code to resolve it. I also note that there is a VERY easy way to get around it, which is build your wizard assembly first and then in your application solution, use assembly references not project references. I personally do this with all 3rd party assemblies I use in order to reduce build complexity, in fact at work these days I am hoping to define a subset of our solutions (which is over 100 projects total) as internal libraries which are compiled early in the build process and then used by assembly reference by all applications.
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Re: Using in VS2005 Toolbox (bug workaround)Todd-Lucas 15:02 14 Oct '07
Hi Al,
Thanks for the reply. No, I don't think there's anything you can do about it. I believe the problem is specific to certain project configurations. Here's another description
The Visual Studio 2005 Toolbox, UserControls and Solution Folders
I wanted to post here in case anyone else out there ran into the same problem.
I think your process makes more sense longer term. I wanted to add your control to my solution for initial testing and development purposes. That's when I encountered the bug.
Thanks for putting together such a cool and high-quality control.
- Todd
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Vista UI-+- Beth Mackenzie -+- 8:44 5 Sep '07
Hi Al,
Thanks for spending the time incorporating your work into practical piece of software. Have you made any provisions for the Vista UI guidelines for wizards in your next version?
I am thinking mainly of the back button (which is a sore point amongst some developers) and the ability to hide and name buttons (I haven't checked how truely exposed the physical buttons are enabled in your code).
Beth
--- Elle A Du Shell
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Re: Vista UIAl Gardner 14:42 14 Oct '07
Actually I am working on supporting the new Vista Wizard format as we speak.
Send me an email and I'll update you when its ready.
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Loclizationhickory 10:43 27 Aug '07
I added [Localizable(true)] to most properties to get the values stored in the resx files rather than the code.
Cheers Jan
Reply·Email·View Thread·PermaLink·Bookmark 1.00/5 (1 vote) Rate this message:12345

Keyboard ShortcutsJoe Hoppe 14:08 10 Jul '07
first of all, this is ingeniously written.
dumb question:
how did you code the keyboard shortcuts for the next and back buttons? i changed the Finish text to Close, and want to change the keyboard shortcut to 'c'.
thanks!
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Re: Keyboard ShortcutsAl Gardner 14:53 14 Oct '07
Change the Finish text to from Close to &Close. At run time the C following the & gets recognised as the shortcut char and will show as underlined. (The & is not shown)
Reply·Email·View Thread·PermaLink·Bookmark Rate this message:12345

Last Visit: Sunday, July 13, 2008 12:46 PM     Last Update:Sunday, July 13, 2008 2:01 PM 1234567Next »
General   News   Question   Answer   Joke   Rant   Admin
PermaLink |Privacy |Terms of Use
Last Updated: 16 Dec 2004
Editor:Chris Maunder
Copyright 2004 by Al Gardner
Everything else Copyright ©CodeProject, 1999-2008
Web12 |Advertise on the Code Project
Help!
Articles
Message Boards
Job Board
Lounge
What is 'The Code Project'?
General FAQ
Post a Question
Site Directory
About Us
Latest
Search
Most Popular
Beginner Articles
Topic List
Submit an Article
Update an Article
Article Competition
ASP.NET
ATL / WTL / STL
C++ / MFC
(Managed) C++/CLI
C#
COM
Hardware
LINQ and .NET 3.5
.NET Framework
OS / SysAdmin
Silverlight
SQL and Database
VB.NET
Web Development
WPF / WCF / WF
XML / XSL
General Discussions
Suggestions / Site Bugs
The Soapbox
All Message Boards...