![]() |
Languages »
C# »
Windows Forms
Intermediate
C# Wizard for BeginnersBy Barretto VNC# Wizard for Beginners |
C#, VC7, VC7.1, .NET, WinXP, Visual Studio, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

Bugs in the installer software have been corrected.
This is a wizard for use in the C# environment.
A lot of time is spent in developing simple but time-consuming user interfaces in Visual studio .NET in the C# environment in the initial stages since, Microsoft Corporation has provided only a plain and simple form in the Wizard which is bundled with Visual Studio, you got to add the controls like Toolbar, StatusBar , Menu which are commonly used in most applications. In order to reduce the burden of creating and adding the usual controls I thought of creating a Wizard which would accomplish all these tasks, I managed to complete the Wizard and have been using it for quite sometime now, so I just decided to give it away others who may want to use it. This is especially useful for beginners who may find it difficult to create those Windows Explorer like interfaces. And since the Add Form option in Visual Studio .NET has a similar plain interface I decided to add a Form Designing wizard using this technique.
With this Wizard you can create the following type of user interfaces

The above interfaces can optionally have
In the above interfaces you can select the Control for each pane from a pull-down list and can also set the System Menu, Minimize and Maximize options, you can also set the Maximized or Minimized state of the Window; Initial size of the Window can also be set.
Menu can be the plain menu as provided by C# or can have a Owner-Drawn menu option, read the "Owner-Drawn Menus" section below.
If you select the Owner-Drawn menu option the menu will be drawn using internal code and look a bit different from the usual C# menus. if you created the application by selecting "Owner-Drawn menus" option and at a latter stage want to add new menu items to the menu, to give the newly added menus Owner-Drawn status, do the following.
For each of the newly added menu items set the OwnerDrawn
property to true, make Checked and
RadioCheck options false (menu items will not be
visible if these are set true either at design-time or through code). if you are
adding a Separator , do not make its OwnerDrawn property
true (I have not found a way out for this). And in the
Form1_OnLoad(..) function add the following lines of code.
this.menuItemFile.DrawItem += new System.Windows.Forms.DrawItemEventHandler(
this.menuItem_DrawItem);
this.menuItemFile.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(
this.menuItem_MeasureItem);
Remember to change the name "menuItemFile" above to the name of
you MenuItem
If you feel the the owner-drawn option is okay and want to add this to any Context Menus that you plan to add to the application you can use the Owner-Drawn state by following the guidelines for normal menu items above.
If you check the Common-Control Manifest option on the User-Interface
Features page a file named <your-Project-Name>.exe.manifest will be copied
in your projects bin\debug folder, when you build and run the project it will
have Windows XP Style look. However, for all controls that you will add to the
project at a later stage, you must set the FlatStyle property, read
the section "About FlatStyle Property".
You have to bundle the manifest file (<your-project>.exe.manifest) along with your applications executable, it must be in the same folder as the applications executable when installing the application at your Client's site
For Controls you add to have a Windows XP like look you have to set the
FlatStyle property to System. There is a down-side to
this setting, you may not be able to display icons or images on these controls
or align Text. Given below is a list of controls, Column "FlatStyle" indicates
if this Controls has "FlatStyle" property, Column "Effective" indicates if
changing this property has any effect on the control.
| Control | FlatStyle | Effective | Control | FlatStyle | Effective |
|---|---|---|---|---|---|
Label |
Yes | Yes | LinkLabel |
Yes | Yes |
Button |
Yes | Yes | TextBox |
No | Yes |
MainMenu |
No | No | CheckBox |
Yes | Yes |
RadioButton |
Yes | Yes | BroupBox |
Yes | Yes |
PictureBox |
No | Yes | Panel |
No | No |
DataGrid |
No | Yes | ListBox |
No | Yes |
CheckedListBox |
No | Yes | ComboBox |
No | Yes |
ListView |
No | Yes | TreeView |
No | Yes |
TabControl |
No | Yes | MonthCalendar |
No | Yes |
DateTimePicker |
No | Yes | HScrollBar |
No | Yes |
VScrollBar |
No | Yes | Splitter |
No | Yes |
DomainUpDown |
No | No | NumericUpDown |
No | No |
TrackBar |
No | Yes | ProgressBar |
No | Yes |
RichTextBox |
No | Yes |
Download the Wizard installer at the top and click on the Install button, if all goes well you can start Visual Studio and you find the icons in the New Project Wizard and Add Form options. This was developed Tested and used on Visual Studio Enterprise edition.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 14 Dec 2003 Editor: Nishant Sivakumar |
Copyright 2003 by Barretto VN Everything else Copyright © CodeProject, 1999-2009 Web20 | Advertise on the Code Project |