There are two ways to create a menu in .NET. Using Visual Studio .NET is by far the easiest. However, it can obscure some of the internal workings, and so later in this chapter you will see a simple menu that uses Notepad.
To get started, fire up Visual Studio .NET and start a new project. Drag a MainMenu item from the Toolbox onto your Form, as shown in Figure 18-1.
Figure 18-2. New menu item
There are a few things to notice in Figure 18-1. First, in the upper-lefthand corner is the new menu item, ready for you to add text. This placement makes adding the menu items incredibly easy. Second, in the lower-lefthand corner, a non-UI element, mainMenu1, has been added. Its properties are visible in the properties window.
Windows Forms and the .NET Framework
Getting Started
Visual Studio .NET
Events
Windows Forms
Dialog Boxes
Controls: The Base Class
Mouse Interaction
Text and Fonts
Drawing and GDI+
Labels and Buttons
Text Controls
Other Basic Controls
TreeView and ListView
List Controls
Date and Time Controls
Custom Controls
Menus and Bars
ADO.NET
Updating ADO.NET
Exceptions and Debugging
Configuration and Deployment