[C # control] menustrip control (Menu Control)

Source: Internet
Author: User

I. Overview

You can open a menu to users by storing commands grouped by general themes.

The menustrip control is a new feature in this version of Visual Studio and. NET Framework. With this control, you can easily create a menu like this in Microsoft Office.

The menustrip control supports multi-Document Interface (MDI) and menu merging, tooltip, and overflow. You can enhance menu availability and readability by adding access keys, shortcuts, selected tags, images, and separators.

The menustrip control replaces the mainmenu control and adds features to it. However, you can also choose to retain the mainmenu Control for backward compatibility and future use.

Ii. Usage and related attributes

You can use the menustrip control:

Create easy-to-Customize common menus that support advanced user interfaces and la s, such as text and image sorting and alignment, drag-and-drop operations, MDI, overflow, and other modes for accessing menu commands.

Supports typical operating system appearances and behaviors.

Event consistency processing is performed on all containers and items. The processing method is the same as that of other controls.

The following table shows some important attributes of menustrip and associated classes.

Attribute

Description

Mdiwindowlistitem

Gets or sets the toolstripmenuitem used to display the list of MDI child forms.

System. Windows. Forms. toolstripitem. mergeaction

Obtains or sets how the child menu and parent menu of the MDI application are merged.

System. Windows. Forms. toolstripitem. mergeindex

Obtain or set the position of the merge items in the menu of the MDI application.

System. Windows. Forms. Form. ismdicontainer

Gets or sets a value indicating whether the form is a container of the MDI child form.

Showitemtooltips

Gets or sets a value indicating whether it is a tooltip for menustrip display.

Canoverflow

Gets or sets a value that indicates whether menustrip supports the overflow function.

Shortcutkeys

Gets or sets the shortcut keys associated with toolstripmenuitem.

Showshortcutkeys

Gets or sets a value that indicates whether the shortcut keys associated with toolstripmenuitem are displayed next to toolstripmenuitem.

Iii. Simple instances

Below is a simple demonstration of the features of menustrip:

1. The overall red line represents menustrip:

2. A specific menu item is called toolstripmenuitem:

3. You can edit the menu items:

 

4. menu item separation line. When editing a menu item, enter:

 

 

 

5. the shortcut keys for menu items can be expressed in (& letters) and set through the shotcutkey attribute.

 

 

6. Set the icon for the menu item:

 

Note: To compare the two shortcut key settings, you 'd better try it yourself:

 

7. Add the exit window code for the exit button:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.