Menus

    Contents
  1. Compiling
  2. Running
  3. Under the Hood
  4. Notes

Hello world form


Compiling

Running

After launching the application, you will see a window displayed with a similar appearance to the one above. The main window contains a main menu with two entries (File and Format).

The main window also has a blue LABEL that contains a context menu, that is the clone of "Format" in the main menu. Right click on the LABEL and a context menu will appear

context menu .

Under the Hood

This application shows how to create a main menu and how to associate a context menu to a control (here to a LABEL). More information regarding the use of menus, is available here .

This sample uses the following classes:

  • FORM
  • CONTEXT_MENU
  • MAIN_MENU
  • MENU_ITEM
  • EVENT_HANDLER
  • LABEL

Notes

This sample is translated from the example located in the QuickStart\winforms\samples\menus subdirectory of the .NET Framework SDK samples directory of Microsoft Visual Studio.NET.