CPS613 |
VB .NET Techniques and References |
|
Windows and Forms |
Special Windowing and Pop-Ups |
Whole Window Controls |
In .NET, MDI is implemented using one MDI form, called the parent form, inside of which other forms (called children forms) exist. When designing an MDI application, the main form is typically the MDI Parent form and the documents being worked on are children form. As usual, only the class of the child form is defined in .NET and this class is instantiated whenever a new document is opened.
Many of the generic MDI features such as the standard menu are built-in the MDI items in Visual Studio. To use these:
.NET and Visual Studio have some built-in classes and form templates to facilitate the creation of dialog boxes: These forms can be created with the Add New Item option by selecting "Dialog" (for a generic dialog box).
.NET also provides some standard windows dialog-box controls and components that you can use in your applications to select colors and fonts, to open and save files, and to set up a page, preview it, and print it.
Once created, dialog boxes are invoked using the ShowDialog Method which will return a different status depending on which button users press to complete their work with the dialog box. This allows the programmer to handle "OK" and "Cancel" (or other actions) differently.
In Visual Studio, menu options are added to the context sensitive menu through the Items property. For cascading menus, the sub-menu of a menu option is added through the DropDownItems property of the first menu.
Editing this menu is fairly intuitive. Separators are defined by typing a dash (-) into one of the entries.
You can create your own bitmaps for the icons in the toolbars/strips directly in VB by Add New Item | Icon File. The icons created will be of the right size and they will also have a transparent background.
The standard Microsoft icons that you can use in your toolbars are in the \Common7\VS2008ImageLibrary\1033\VS2008ImageLibrary.zip file of your Visual Studio installation directory (which can be either "C:\Program Files\Microsoft Visual Studio 9.0" or "C:\Program Files (x86)\Microsoft Visual Studio 9.0"). As you will notice, each picture is available in multiple sizes. You can use Microsoft Paint to edit these pictures to pick the size that fits your buttons best (which you can determine from the Size property of your control) and then add these as Resources which you can them simply select as your button pictures.
In particular, the ToolStripProgress Bar can be added with the designer by clicking directly into the status strip. You do not need to drag a separate ProgressBar control from the toolbox. These other ProgressBar controls are intended to be integrated in different areas of the window.
The Spring Property of an element of a StatusStrip is used to specify whether that element will expand to fill the entire status bar if it can. By default, it is set to False, which means that by default the elements of a status strip will remain on the left of the Status strip. If you want to have some of these elements on the right instead, you should set their Spring property to True.