First knowledge of windows program knowledge, first knowledge of windows

Source: Internet
Author: User

First knowledge of windows program knowledge, first knowledge of windows

When we first know a thing, we will be unfamiliar, and we will understand it slowly. Let me take you to understand it.

  

1. Form is a basic Form class defined by. Net Framework. It has basic Form attributes and methods.

Attribute Description
MaximizeBox Confirm the upper-right corner of the Form title bar ------ whether a maximized box exists --------- the default value is True.
ShowInTaskbar Determine whether the form appears in the ---------- taskbar ------ the default value is True
StartPosition Determine the position of the first appearance of the form ----------
WindowState Determine the output status of the form
FormBorderStyle After startup, you can drag the form size --------------- and set the value to FixedSingle.
Method Description
Close () Close form
Show () Display form
ShowDialong () Modular display form
Hide () Hide form

Ii. Basic controls

Label ------------------ -------------------- eg. User Name

TextBox ------ Blank box -------------------

Attribute Description
MaxLength Specify the maximum number of characters entered in the text box
Multiline Whether multiple lines of text can be entered
PasswordChar Password box
ReadOnly Read-Only cannot be changed

ComboBox ------ ---------- eg. login type, administrator and user

Attribute Description
Items Items in the combo box
DropDownStyle Allow users to edit text boxes
SelectedIndex Index Number of the currently selected project, starting from 0
SelectedItem Obtain the currently selected items
Event Description
Click An error occurred while clicking the control.
SelectedIndexChanged Occurs after the SelectedIndex attribute is modified.
Method Description
Add () Add Project
Clear () Remove all items
Remove () Remove a specified item

Button )--------------

Attribute Description
Enable Boolean value, indicating whether the control can be used

Message Box)

In Windows, the message box is a MessageBox object. To create a message box, you must use the MessageBox. show (); method.

There are four types of commonly used message boxes.

01. MessageBox. Show (string to be displayed );

02. MessageBox. Show (string to be displayed, message box title );

03. MessageBox. Show (string to be displayed, message box title, and message box button );

04. MessageBox. Show (string to be displayed, message box title, message box button, and message box icon );

eg:MessageBoxButton.AbortRetryIgnore

 

MessageBoxButton.OK

MessageBoxButton.OKCancel

MessageBoxButton.RetryCancel

MessageBoxButton.YesNo

MessageBoxButtons.YesNoCancel

The third parameter MessagBoxButton is used to set the button displayed in the message box. You can select the type of the button in the form.

MessageBoxIcon.Information

MessageBoxIcon.Error

MessageBoxIcon.Exclamation

MessageBoxIcon.Question

Menu Bar control (MenuStrip )------------

Toolbar Control (ToolStrip )----------------------

Attribute Description
ImageScalingSize The item in the toolbar shows the image size.
DisplayStyle Set display image or text
ImageScaling Adjust button or label to display the image size

Radio button (RadioButton )--------------

Group box (GroupBox )-------------

Panel ---------- add student users

Date control (DateTimePicker )-------------------

Attribute Description
Value Date and control value selected by the Control

Image list control (ImageList) ---- ------ ColorDepth (obtain the color depth of the image list)

Shortcut menu (ContextMenuStrip )------

Attribute Description
Displaystyle Whether to display text and images
GridLines Display gridlines --- default value true
MultiSelect Multiple options are not allowed. The default value is False.

PictureBox)

Timer control in the toolbox )-----

Attribute Description
Interval Event frequency, in milliseconds
Enabled Whether to periodically trigger an event (ON or OFF)
Event Description
Tick Events that occur at a specified interval
Method Description
Start () Start Timer
Stop () Stop Timer

4. Code Parsing

Event: when a user triggers certain actions of a button through the mouse or keyboard"

 

 private void button1_Click(object sender, EventArgs e)        {            this.Close();        }

 

Sender -------------- is the event Source

E ------------ is an event parameter (EventArgs) object

Use a code in the form to Close the form -------------- this. Close ();

This --------- is a keyword that represents the current form object.

The Close () ---------- method is a Form-like Form method, which is used to Close the Form.

5. Jump to the form

Private void buLogin_Click (object sender, EventArgs e) {// call the method From a = new From (); Show (); // Hide the method This. Hide ();}

 

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.