Windows Forms Menu Design Full introduction

Source: Internet
Author: User

[Foreword:] C # Not only inherits the powerful features of C + +, Java and other object-oriented, but also inherits the visual rapid development function of VB, Delphi and other programming languages, also known as the first fully component-oriented language. While Microsoft will promote the C # language as a mainstream tool on the web, it is in the traditional client/server model of programming, especially in Microsoft. NET platform system, C # 's powerful, Easy-to-use features will become the preferred tool for Windows application software developers.

In Windows programming, the menu acts as the user's preferred tool for interacting with the program. NET C # is how to quickly construct a menu in Windows Forms? How to master the essence of the Windows Forms menu, in the program design to be handy, do whatever it takes to develop a form menu program? This article will give you the most comprehensive answer.

Introduction to Windows Forms Menu Programs

We know that in Windows programs, menus are an essential program element. By using the menu, the various operation commands of the program can be expressed to the user in a very canonical and efficient way. A Windows Program menu typically includes a main menu (the main menu contains many submenus) and a number of pop-up menus. Clicking the menu item program will perform the appropriate function; In addition, clicking the right mouse button in many parts of the program form will pop up a targeted shortcut menu (also known as a pop-up menu), and clicking will perform the function to make the application of the software easier and more humane. Microsoft Windows and its applications stand on the top of the desktop and software, and friendly menu apps make no small contribution.

As with traditional Windows programs, menus in Windows Forms programs include both general menus and pop-up menus. The General menu mainly refers to the main menu of the form and submenus. Menu dependencies feature appearance and main functions can also be categorized: Command menu, select menu, Link menu and separate menu, and so on.

We must have used rapid development (RAD) language tools (such as VB, Delphi, etc.) designed the menu program. With these development tools, you only need to drag and drop the menu control with the mouse onto the form, and complete the very friendly menu program development with a simple menu appearance and properties settings. In. NET, C # supports rapid development, so you can do most of the menu programming with a simple mouse drag-and-drop operation by using the appropriate development tools, such as visual Studio. Net. Of course, because of the powerful features of C #, use. NET provides a menu class, you can also write a good user interface menu program by using plain text editing tools such as Notepad.

However, only when we fully grasp the essence of the Windows Forms menu, we can do our best in the program design and develop the form menu program.

Two, the menu program uses the class and the system structure

In the. NET class library, a very large base class is defined for users to use in a variety of programming. In these classes, there are several classes that you can use to write a menu program for your users, and by using these classes, you could design any menu you want. Here are a few simple introductions:

2.1 Windows Forms Menu Class architecture

. NET class Library, the menu class defines the following architecture:

Object

MarshalByRefObject

Component

Menu

ContextMenu

MainMenu

MenuItem

From the structure above, we can see that the menu program design mainly uses three classes that inherit from the menu class: ContextMenu, MainMenu, and MenuItem, which encapsulate the definition of pop-up menus, main menus, and menu items respectively.

Other than that. NET class Library also provides a Menu.MenuItemCollection collection class to facilitate the management of individual menu items. The definition is as follows:

public class menu.menuitemcollection:ilist,icollection,ienumerable;

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.