Build a well-laid Windows program

Source: Internet
Author: User

1. Using the menu bar control MenuStrip

In the menu bar you can add menu items (MenuItem), combo boxes (ComboBox), text boxes (textbox),

Main properties of MenuStrip

Name: Names of menu objects in code

Items: A collection of items displayed in the menu bar

Text: Texts associated with the menu

Main properties and events of MenuItem

Name: Names of menu objects in code

DropDownItems: A collection of items displayed in a submenu

2. Shortcut keys

(1) Select the menu item you want to add

(2) After the menu item text, enter & speed up the key letter

The naming conventions for menu bars and items are as follows

When setting the Name property for a menu item, prefix MS, such as: Msuser,msadmin, etc.

When setting the Name property for a menu item, prefix Tsmi, such as tsmiaddstudentuser,tsmiexit, etc.

1.2 using the toolbar control ToolStrip

The toolbar control can contain buttons (button), label (label), drop-down button (DropDownButton), text box (textbox), combo Box (combobox), etc., can display text, picture or text plus pictures

Main properties

Imagescalingsize: Items in the toolbar display the size of the image

Items: A collection of items that are displayed on the toolbar

Key properties and events for buttons and labels on the toolbar

Displaystyle: Set how images and text are displayed

Image: The picture displayed on the button/label

Imagescaling: Whether to adjust the size of the picture displayed on the button/label

Text: Buttons/labels displayed on

Textimagerelation: The relative position of the button/label like the text

2.1 Basic control of the system

Main properties and Events

Checked: Indicates whether the radio button is selected

Text: radio button display

Click: Occurs when a radio button is clicked

Each control has a Name property that is used to represent the object in code. Each time we drag and drop onto a control on a form, you first need to name the control. The usual prefix: label lbl,textbox for Txt,radiobutton for Rdo,combox for CBO

2.2 Arranging controls on a form

(1) Select the controls you want to align

(2) In the VS menu, select the "format", "Align" option, click the way you want to align

(2) In the Properties window, click the Anchor property right arrow to display the Anchor property editor

(3) Select or clear the edge of the control anchor on the displayed Doji

2.3 Creating an MDI Application

1. Why use MDI

Open multiple files in the same window

2. What is MDI

MDI (multiple file interface)

3. How to create an MDI

(1) Set the parent form to set the parent form's IsMdiContainer property to True

(2) Setting up a subform: Set the MdiParent property of the subform to this in code before calling the show () method of the subform to open it

3 Combo Box combobox control

Common Properties and methods

Count: Gets the number of items in the collection

IsReadOnly gets a value that indicates the ability to modify the collection

Item: Retrieves the item from the specified index in the collection

Method:

Add (): Adds an item to the list of items in the combo box

Build a well-laid Windows program

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.