13.7. MDI, Menus, and File Dialogs

In this section I want to show you how to use the Multiple Document Interface, the C# menu object, and the file dialog objects. Start by creating the project as you have all the others. With the frmMain form showing in the Design window, set the form's IsMdiContainer property to true. When you do this, the style of the form changes and the client area of the form changes to a dark shade of gray. Scroll to the bottom of the form's property list and set the WindowState property to Maximized.

13.7.1. Adding a Menu

Now go to the Toolbox window, open up the Menu & Toolbars section, and double-click on the MenuStrip object. Your Design window should look like the one in Figure 13-13. Notice that the MenuStrip object (named menuStrip1 by default) appears in the System Tray area at the bottom of the screen. (It is not viewable in Figure 13-13.) The object also causes a blank menu strip to appear just under the title bar of frmMain, as can be seen in Figure 13-13.

Figure 13-13. Figure 13-13

Place the cursor in the textbox on the menu strip where it says Type Here, type in &File, and press the Enter key. Your screen should look like Figure 13-14.

Figure 13-14. Figure 13-14

In Figure 13-14 there are two Type Here boxes. While it may not be obvious, the ...

Get Beginning C# 3.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.