spacer
Yehuda Shiran September 9, 2002
Hierarchy Levels of Menus
Tips: September 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

You can use JScript .NET to add menu bars to a Windows form. Suppose we want to add the File menu at the top menu bar, as you find in most applications. Let's further assume that we want to include a single item in this File menu, the Save entry. In addition, we want to have a shortcut key for this entry, which is CTRL-S, as in most Windows applications.

Windows forms support two relevant classes for menu building: MainMenu and MenuItem. A menu item in Windows forms needs three variables:

  • The top menu bar
  • The menu column (File in our case)
  • The menu item (Save in our case)

Let's call these variables menuMain, menuFile, and menuSave. We define them as follows:

  var menuMain : System.Windows.Forms.MainMenu;
  var menuFile : System.Windows.Forms.MenuItem; 
  var menuSave : System.Windows.Forms.MenuItem;
To learn more about JScript .NET and ASP.NET, go to Column 117, JScript .NET, Part XI: Creating Windows Forms.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business