Windows program control upgrade ==>> build a well-laid Windows program

Source: Internet
Author: User

01. Menu bar (MenuStrip)

01. Look at this is the charm of MenuStrip:

02. In addition to some common properties (name.text.) In addition, there are:

03. Some people will ask: the shortcut key:

Method:

mode one : 1. Set the Text property of the menu item to (Open (&f)),

You must first press ALT + main Menu shortcut key to enter the corresponding main menu,

Then press f directly to open the subform.

mode two : set by the Shorcartkeys property of the menu item.

To create the corresponding key combination, you can press the main interface directly into the corresponding

Letter keys to open subforms

04. Hey, teach you how to divide the lines (very simple!)

method One : Insert a split Line

method Two: Enter a minus sign (-)

02. Toolbars (ToolStrip)

01. Main properties of a toolbar control

(1) Imagescalingsize: The size of an image displayed by an item in the toolbar

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

02. Key Properties and events for buttons and labels on the toolbar

Property:

(1) Displaystyle: Sets how images and text are displayed, including displaying text, displaying images, displaying text and images, or displaying nothing

(2) Image: The pattern shown on the button/label

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

(4) Text: Buttons/labels displayed on

(5) Textimagerelation: Relative position of text on button/label

Event:

Click: Event triggered when a button/label is clicked

Commonly used:

01. Set the picture to the toolbar item, first the picture size is controlled by the whole ToolStrip,

Sets the imagescalingsize value to the pixel value of the picture itself.

02. Add the type of each item commonly used as DropDownButton

03. Set the Text property to display

04. Set the Displaystyle property to ImageAndText so that the picture and text are displayed simultaneously

The relative position of the 05.TextImageRelation image and the text

06. Don't forget to change the Name property of each control

Application. Use of Exit () and This.close ()

Difference:

Application.exit ();//exit the entire application ===========>> generally in the FormClosing event

This. Close ();//Closes the current form

04. Use of some common controls

1. RadioButton: Radio button

Main properties:

(1) Checked: Indicates whether the radio button is selected

(2) Text: radio button display

Event: Click: Occurs when a button is clicked

2.DateTimePicker: Date control (optional Date drop-down box without hand loss)

Main properties:

(1) MaxDate: Get set maximum date and time

(2) MinDate: Get set minimum date and time

(3) Value: the date/time value selected by the control

Note the value. Different methods will have different display methods:

MessageBox.Show (datetimepicker.value. Tolongdatestring ());

MessageBox.Show (datetimepicker.value. Tolongtimestring ());

. MessageBox.Show (Datetimepicker.value. ToShortDateString ());

. MessageBox.Show (Datetimepicker.value. Toshorttimestring ());

MessageBox.Show (datetimepicker.value. ToString ());

(4) Format: Formats for setting the date and time displayed in the control

Example:

01. For Long

02. For short

03. For TIME

04. For Custom

3.GroupBox: Group box = = To provide a recognizable grouping for other controls

The following "User registration information" is a group box

4.Panel: Panel and its functions and grouping boxes are similar, are used to group the control, the only difference is that the panel does not have a title, but can display the scroll bar

The following gender and other content is placed in a "panel", is not to see, you Ah! Try to know the charm of it.

05.Anchor and Dock Properties

Anchor: The pixel value that keeps the position of the control and the edge of the form fixed.

Dock: Make a control dock to a part of the form (top,bottom,left,right), or fill the entire form (fill)

06. Setting up an MDI form

As follows: The internal form does not appear outside of its form

And, in the computer's taskbar will only show one of its main icon, this will appear very professional!

Operation Method:

the main (parent) IsMdiContainer property is set to True

The following code is added before the subform show ():

frm. Mdiparent=this;//this represents the current form.

07. Notes on the ReadOnly attribute

If you set the ReadOnly property on a textbox, setting the font foreground color is not working, and you must set the BackColor to any of the colors outside the control.

Speaking of which, it's over, bye, guys!

Windows program control upgrade ==>> build a well-laid Windows program

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.