How to easily adjust the VB. NET Control

Source: Internet
Author: User

The anchor attribute can be set to any combination of top, bottom, left, and right. The default value is top and left. This ensures that the top-left corner of the control has the same relative position as the window border. You can set the anchor attribute to top and bottom to vertically adjust the control to ensure that the distance from the bottom of the window to the bottom of the control is the same.

 

Me. textbox1.anchor =

(System. Windows. Forms. anchorstyles. Top or system. Windows. Forms. anchorstyles. Left)

 

Dock Properties

This attribute can be set to top, bottom, left, right, or fill. Setting it to top, bottom, left, or right can make the control close to the specified edge of the window, or other controls placed next to the edge of the corresponding window. Setting the dock property to fill allows the control to be adjusted to the entire customer zone filled with windows.

 

Me. panel1.dock = system. Windows. Forms. dockstyle. Bottom

 

You can also use the dockpadding object to set the area between the filled window border and the placed control. It has the attribute corresponding to each window border. If you want the border to be consistent with each edge, you can also set the all attribute.

 

Me. dockpadding. All = 5

 

The new control adjustment function in Visual Basic. Net eliminates many necessary adjustment programs in earlier Visual Basic versions. Most adjustment tasks can be handled by setting new anchor and dock attributes in the Windows design without programming.

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.