Windows Form-----Content (1)

Source: Internet
Author: User
Tags transparent color

Form:

First, control the title bar

text--control the text of the title bar

icon--control the icon for the title bar

maximizebox--whether the upper-right corner of the form title bar has a maximize box (Ture/false)

minimizebox--If there is a minimized box (Ture/false) in the upper-right corner of the form's title bar

controlbox--all maximize, Minimize, close buttons (ture/false)

Second, the control background

backcolor--Control Background Color

backgroundimage--Control Background Map

BackgroundImageLayout-How the background is laid out

tile--Tile, center--centered, stretch--stretched, zoom--proportionally scaled

Third, control the border

formborderstyle--style of control border
sizable--adjustable border; fixedsingle--non-adjustable border; none--borderless.
Size (width,height): The size of the form.
MinimumSize (Width Height) The smallest size//Basic No
MaximumSize (Width Height) maximum size//Basic No

Iv. control of the background

ForeColor--Text color
font--text Font

V. Secondary properties

WindowState--The form's start state.
normal--the size of the design time. maximized--the form to start maximized. minimized--start minimized.

StartPosition--The start position of the form.
Centerscreen--In the center of the screen

ShowInTaskbar (True/false)-Whether the form is displayed on the taskbar when it is run.
Topmost (True/false)-whether to put the top level display
Opacity--transparency. 100% completely opaque. 0% completely transparent.
TransparencyKey-Transparent color of the form.

case One: Make a mask form:
1. Remove the frame. FormBorderStyle = none;
2. Set to maximize startup. WindowState = maximized
3. Set the background color to black. Backcolor=black
4. Set as top-level form topmost = True
5. Settings are not displayed on the taskbar. Showintaskbar=false

Tip: Add a new form and set it as the startup form:
1. Right-click the project in the Solution Manager and select Add-windows form.
2. In the solution Manager, open the Program.cs and modify the Application.Run () later.

case Two: Make an irregular form:
1. Find a picture of an irregular transparent background.
2. Set the background of the form to this picture.
3. Set the form's Transparent color TransparencyKey
4. Remove the frame. Formborderstyle=none

second largest content: three most commonly used controls:
Tags: label
Text-label text
Image-Images
TextAlign-Position of text 9 positions
ImageAlign-position of the image 9 positions
Autosize-true-is automatically resized, with only one control point. The false-is manually resized and has 8 control points.

forecolor--text color
backcolor--background Color
font--fonts


Buttons: Button
Text-button text
Image-Button picture
TextAlign-Position of text 9 positions
ImageAlign-position of the image 9 positions
The shape of the flatstyle-button. standard-Standard. flat-plane state. popup-a little bulge.
Flatappearence-Detailed settings for button border formation.
forecolor--text color
backcolor--background Color
font--fonts

Note: There are two important properties in the form: Acceptbutton,cancelbutton is used to specify two buttons respectively. Pressing the ENTER key on the form automatically calls the code in AcceptButton, and pressing ESC will call CancelButton's code.


text box: TextBox
Text-button text
Whether the multiline-is a multiline text box. true-multiple lines of text, false-single-line text
passwordchar-character styles in the password box
readonly-Read only, can't change
maxlength-Maximum number of inputs

case Three: do a login form, and implement the login function.

RadioButton (radio), CheckBox (multiple selection)
text-text on a radio button
Checked (True\false)-Whether the radio button is selected
Tag-Generally uses the value behind the Save radio button.

Image-Images
Textalgin,imagealign
Appearance: button appearance. normal-common radio buttons. button-radio buttons in the form of buttons

Font,forecolor,backcolor.

Case (radio): How to get the selected item from a bunch of radio buttons.
Traverse each control of a form
foreach (Control ctrl. Controls)
{
Determine if each control is RadioButton
If (Ctrl is RadioButton)
{
If it's radiobutton, turn it into RadioButton.
RadioButton RB = (RadioButton) Ctrl;
If it is selected, ....
if (RB. Checked)
{
if (Convert.ToInt32 (RB. TAG) < 4)
{
Label1. Text = "highly educated ah";
}
Else
{
Label1. Text = "General degree of education ah";
}
}
}
}
case (multiple selection): int sum=0;
foreach (Control Ctr in Groupbox2.controls)
{
If (Ctr is CheckBox)
{
CheckBox cb = (checkbox) Ctr;
if (CB. Checked)
{
Sum +=convert.toint32 (CB. TAG);
}
}
}
Label2. Text = "Total Price is:" + sum + "Yuan";

Container: GroupBox or Panel
Case: How to resolve a form multiple group radio button separate selection situation?
Use a container panel such as GroupBox or panel.

Windows Form-----Content (1)

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.