Winform form attribute settings

Source: Internet
Author: User

This article from: http://www.cnblogs.com/laoai/archive/2011/03/07/1974209.html

 

 

1. Make the form appear at the specified position at startup

Form1.startposition
Manual
Centerscreen
Windowsdefaultlocation (default)
Windowsdefaultbounds
Centerparent

The setting is valid only before the form is started.

2. Set the icon of the form.

Form1.icon

3. Set the form to become the parent form of multiple child forms

Form1.ismidcontainer = true/false (default)

During design, a project can have only one parent form.

4. specify the maximum and minimum button actions

Form1.controlbox = true (default)/false // you can specify whether to maximize, minimize, or close a button.
Form1.maxmizebox = true (default)/false // sets whether the maximize button is valid
Form1.minimizebox = true (default)/false // sets whether the minimization button is valid.

If controlbox = true maxmizebox = false minimizebox = false and helpbutton = true
You can see a Help button next to the close button.

5. If you want to display a normal menu in the form, you need to add the menu control mainmenu.

The form1.menu option is used to specify the menu to use.

If you want to dynamically load the menu, prepare the mainmenu control to be used, and change the value of form1.menu at the appropriate time.

To use a shortcut menu, add the contextmenu control to the form. Specify form1.contextmenu as the control.

6. Set the transparency of the form.

Form1.opacity

The value is a percentage in the range of 0 ~ 100%. When it is equal to zero o'clock, the form cannot be hidden. When it is equal to 100%, this form is a normal form.

7. Set whether to display the form in the taskbar

Form1.showintaskbar = true (default)/false

The default value is true. If it is set to false, it disappears from the taskbar. Usually, you can use policyicon to implementProgramHide it to the system status bar in the lower-right corner of the system.

8. Set whether to display the adjust handle in the lower right corner of the form

Form1.sizegripstyle = auto (default)/show/hide

The default value is auto, so it determines whether to display the Handle Based on the display style of the form. For example, when the form is set to a box that cannot be adjusted, this handle will not appear.

9. Set the form to the front-end reality, such as some player and chat software. They are usually on top of all forms.

Form1.topmost = true/false (default)

10. Set partially transparent form

Form1.transparencykey

It accepts a color value. When the color in the form is the same as the set color, the system sets the areas of these colors to transparent.

11. Set the background image of the form.

Form1.backcolor // set the background color of the form
Form1.backgroundimage // sets the background image of the form.

12. Set the mouse pointer shape in the form

Form1.cursor

13. Set the appearance and style of the form border.

Form1.formborderstyle

None
Fixedsingle
Fixed3d
Fixeddialog
Sizable (default)
Fixedtoolwindow
Sizabletoolwindow

14. Change the Form title

Form1.text

15. Set the default confirmation button and cancel button for the form.

Form1.acceptbutton // sets the default confirmation button
Form1.cancelbutton // sets the default cancel button

You must add two buttons to the form before assigning them to the corresponding properties.

1. Make the form appear at the specified position at startup

Form1.startposition
Manual
Centerscreen
Windowsdefaultlocation (default)
Windowsdefaultbounds
Centerparent

The setting is valid only before the form is started.

2. Set the icon of the form.

Form1.icon

3. Set the form to become the parent form of multiple child forms

Form1.ismidcontainer = true/false (default)

During design, a project can have only one parent form.

4. specify the maximum and minimum button actions

Form1.controlbox = true (default)/false // you can specify whether to maximize, minimize, or close a button.
Form1.maxmizebox = true (default)/false // sets whether the maximize button is valid
Form1.minimizebox = true (default)/false // sets whether the minimization button is valid.

If controlbox = true maxmizebox = false minimizebox = false and helpbutton = true
You can see a Help button next to the close button.

5. If you want to display a normal menu in the form, you need to add the menu control mainmenu.

The form1.menu option is used to specify the menu to use.

If you want to dynamically load the menu, prepare the mainmenu control to be used, and change the value of form1.menu at the appropriate time.

To use a shortcut menu, add the contextmenu control to the form. Specify form1.contextmenu as the control.

6. Set the transparency of the form.

Form1.opacity

The value is a percentage in the range of 0 ~ 100%. When it is equal to zero o'clock, the form cannot be hidden. When it is equal to 100%, this form is a normal form.

7. Set whether to display the form in the taskbar

Form1.showintaskbar = true (default)/false

The default value is true. If it is set to false, it disappears from the taskbar. Usually, you can use policyicon to hide the program to the system status bar in the lower right corner of the system.

8. Set whether to display the adjust handle in the lower right corner of the form

Form1.sizegripstyle = auto (default)/show/hide

The default value is auto, so it determines whether to display the Handle Based on the display style of the form. For example, when the form is set to a box that cannot be adjusted, this handle will not appear.

9. Set the form to the front-end reality, such as some player and chat software. They are usually on top of all forms.

Form1.topmost = true/false (default)

10. Set partially transparent form

Form1.transparencykey

It accepts a color value. When the color in the form is the same as the set color, the system sets the areas of these colors to transparent.

11. Set the background image of the form.

Form1.backcolor // set the background color of the form
Form1.backgroundimage // sets the background image of the form.

12. Set the mouse pointer shape in the form

Form1.cursor

13. Set the appearance and style of the form border.

Form1.formborderstyle

None
Fixedsingle
Fixed3d
Fixeddialog
Sizable (default)
Fixedtoolwindow
Sizabletoolwindow

14. Change the Form title

Form1.text

15. Set the default confirmation button and cancel button for the form.

Form1.acceptbutton // sets the default confirmation button
Form1.cancelbutton // sets the default cancel button

You must add two buttons to the form before assigning them to the corresponding properties.

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.