Click here to Skip to main content
15,886,689 members
Articles / Programming Languages / C#
Article

C# Wizard for Beginners

Rate me:
Please Sign up or sign in to vote.
3.59/5 (29 votes)
14 Dec 20034 min read 95.8K   1.7K   45   8
C# Wizard for Beginners

Image 1

What's new?

Bugs in the installer software have been corrected.

Introduction

This is a wizard for use in the C# environment.

Background

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.

Features

With this Wizard you can create the following type of user interfaces

  • Plain Form
  • Windows Explorer like interface (vertical)
  • Windows Explorer like interface (horizontal)
  • Windows Explorer like interface (3-Pane)
  • Outlook Express like interface
  • Single Document interface
  • Multi Document interface

Image 2

The above interfaces can optionally have

  • ToolBar
  • StatusBar
  • MainMenu
  • About Box

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.

Owner-Drawn Menus

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.

C#
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.

Common-Control Manifest

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

About FlatStyle property

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.


ControlFlatStyleEffectiveControlFlatStyleEffective
LabelYesYesLinkLabelYesYes
ButtonYesYesTextBoxNoYes
MainMenuNoNoCheckBoxYesYes
RadioButtonYesYesBroupBoxYesYes
PictureBoxNoYesPanelNoNo
DataGridNoYesListBoxNoYes
CheckedListBoxNoYesComboBoxNoYes
ListViewNoYesTreeViewNoYes
TabControlNoYesMonthCalendarNoYes
DateTimePickerNoYesHScrollBarNoYes
VScrollBarNoYesSplitterNoYes
DomainUpDownNoNoNumericUpDownNoNo
TrackBarNoYesProgressBarNoYes
RichTextBoxNoYes

How to Install

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.

History

  • New Article Release dated 21 - November - 2003.
  • Bugs in Installer corrected

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 found here


Written By
India India
Nothing to boast about

Comments and Discussions

 
QuestionMay be source code? Thanks! Pin
PetrosPetrosean22-Dec-15 6:22
PetrosPetrosean22-Dec-15 6:22 
GeneralMy vote of 1 Pin
Martin Hofmann16-Jun-10 23:55
Martin Hofmann16-Jun-10 23:55 
GeneralIt Stinks Pin
Michael.Fischer19-Mar-04 9:45
Michael.Fischer19-Mar-04 9:45 
GeneralRe: It Stinks Pin
cycnus20-Mar-05 0:41
cycnus20-Mar-05 0:41 
GeneralWon't install Pin
Greg Donovan1-Jan-04 16:48
Greg Donovan1-Jan-04 16:48 
GeneralRe: Won't install Pin
Barretto VN3-Jan-04 0:16
Barretto VN3-Jan-04 0:16 
GeneralInstall won't work Pin
bobfox21-Nov-03 2:49
professionalbobfox21-Nov-03 2:49 
GeneralNice, but ... Pin
garythom_work21-Nov-03 2:45
garythom_work21-Nov-03 2:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.