Initial knowledge of Windows programs

Source: Internet
Author: User

Window operating system, everywhere is the form

Simple, powerful, convenient and flexible

Steps to create a new project project type Visual C # project Template window application

Separate the code for the same form into two files with partial:

One stored in VS auto-generated code

Colon denotes inheritance

Like a child inherits the characteristics of a parent all forms inherit form

Form title: Name

Form icons: Icon

Picture Background backgroundimage

Background color BackColor

Maximize button: Maximinbox

Minimize button: Minimun

form border Style: Fromborderstyle

Form initial Position: StartPosition

Form Status: Windowsstate

Help button: HelpButton

Naming conventions-prefixes

Control Name control class name naming prefix

Tag Label Lal

Text box textbox txt

Combo box ComboBox Cbo

Pushbutton button BTN

Normalization of naming improves program readability and maintainability

Tag label

Image: Images on a label

Text: Display of texts

Text box textbox:

MaxLength: Maximum number of characters

MultiLine: Whether multiple lines of text can be entered

PasswordChar: The password character that is displayed as a password box

ReadOnly: whether to allow editing

Text: Associated Literals

Combo Box combobox

Items: item in a combo box

DropDownStyle: Style of combo box

Text: Combo box associated

SelectedIndex: Index of the currently selected item, starting at 0

SelectedItem: Gets the currently selected item

Buttons button

Enable: Whether the control is available

Text: Display file

TextAlign: How text is aligned

Windows applications are event-driven

Event-driven: respond to user-triggered events at any time, making appropriate processing

What we need to do.

Write the appropriate event handlers for related events

Steps for writing event handlers

Select the control in the Properties window click Find Event double click Generate event handling method to write processing code

If the event event handling method is not triggered, check that the event handler is set correctly in the Properties window

form from

Load event: triggered when form loads

Text box textbox:

TextChanged event: triggered when text changes

Buttons button

Click event: Clicked Trigger Touch

There are so many events for each control that we only need to focus on common events

MessageBox message Box

Why use a message box?

displaying messages

Request a message to a user

Implementation steps

1 Defining Form Objects

2 Display Form

Grammar

The called Form class name Form object =new the Called Form class name ();

The Form object. Show ();

Initial knowledge of Windows programs

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.