C# Winforms Wizard

Introduction

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

Background

A lot of time is spent in developing the simple but time-consuming user interface in Visual Studio .NET in the C# environment in the initial stages because Microsoft Corporation has provided a plain and simple form in the Wizard that is bundled with Visual Studio. You got to add controls such as a Toolbar, StatusBar, and Menu that are commonly used in most applications. To reduce the burden of creating and adding the usual controls, I thought of creating a wizard that would acomplish all these tasks. I managed to complete the wizard and have been using it for quite some time now, so I just decided to give it away to 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, because the Add Form option in Visual Studio .NET has a similar plain interface, I decided to add a Form Designing wizard using this technique.

Important Note

This project was developed and tested under Visual Stucio .NET (Enterprise Edition) and it installs well in versions 1.0 and 1.1; users of the "Standard Edition" may not be able to install thise wizard.

Features

With this wizard, you can create the following types 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 Docuemnt interface
  • Multi Document interface

Following are images of the wizard at work:

The above interfaces optionally can have:

  • ToolBar
  • StatusBar
  • MainMenu
  • About Box

In the above interfaces, you can select the Control for each pane from a pull-down list and also can set the System Menu, Minimize, and Maximize options. You also can set the Maximized or Minimized state of the Window; the Initial size of the Window also can be set.

The menu can be the plain menu that C# provides or it 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 the "Owner-Drawn menus" option and at a later stage you want to add new menu items to the menu, do the following to give the newly added menus Owner-Drawn status.

For each of the newly added menu items, set the OwnerDrawn property to true; make the 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 Seperator, 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 your MenuItem.

If you feel that 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.

How to Install

Download the wizard installer at the top and click the Install button. If all goes well, you can start Visual Studio and find the icons in the New Project Wizard and Add Form options. This was developed, tested, and used on Visual Studio Exterprise edition.

History

New Article Release dt 2 - April - 2004.



Downloads

Comments

  • Latest Updates

    Posted by barretto_vn on 03/15/2005 08:40am

    for updates to this and more of my articles go to http://members.lycos.co.uk/barrettovn Barretto VN

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds