0% found this document useful (0 votes)
14 views1 page

Complete-Reference-Vb Net 90

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

Complete-Reference-Vb Net 90

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

MDI Applications

You can also set the following properties while in this method, or from the Properties window:

Me.Name = "MainForm"
Me.Text = "Indexworks"
Me.WindowState = FormWindowState.Maximized

At this point, it makes life easier if you rename the actual source code file to something more meaningful than
Form1.vb. I changed the name to MForm (for main form), which tells me that the form contains the source for
the parent form. I also renamed the class file for the form to MainForm, which is more useful than Class1.
The Text property shown in the preceding code is the caption at the top of the parent form, which you reserve
for the name of the application.

It is easier to work with MDI child windows when the parent form is maximized. You will also notice that the
edges of the MDI parent form will be the same as the system color, which you set in the Windows System
control panel. This property is not affected by the back color set using the Control.BackColor property. At
this juncture, if the form is too small in the designer, you can make it bigger by dragging with the mouse, or
you can set the height and width with the following code in the InitializeComponent method:

Me.ClientSize = New System.Drawing.Size(600, 400)

Once this is done, you can add the first menu resources to the parent form as follows:

1. Switch to visual mode and click the form so that the Toolbox becomes active.
2. Drag or double−click a MainMenu component from the Toolbox palette to the form. The first thing
you'll notice is that the menu hides as soon as it hits the form. You can get it back from the
drop−down list at the top of the Properties window.
3. Click the menu component's top−level menu item and set the property to &File. You can also create
sub−submenu items like &New, &Close, and &Exit in the same manner. And you can also create
top−level menu items called &Window and &Help, although a Help menu may be a long way off at
this stage from being implemented (nothing wrong with starting the Help system at the beginning of
the development; after all, if you followed my advice in the past chapters, most of the applicationthe
code behindhas already been built). The File menu items are where you write the code to create, and
open windows, and the Close menu will be used to close down the application. The Window menu
will be used to keep track of open MDI child windows that are enumerated. The menus and the form
built at this point are illustrated in Figure 16−4.

Figure 16−4: The new MDI parent form and initial menus

Tip Rename the menus from the default identifiers, like MenuItem2, that Visual Studio assigns. This
will make it easier for you to find and set properties in the correct menu item later when the
number of menus listed in the Properties window grows. You also need more intuitive menu
names for the event wiring that comes later when you connect the click on a menu item to an

574

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy