Visual Basic. Net makes it easier to place and adjust controls than in Visual Basic 6. Majority
System. Windows. Forms The visual control in the namespace is composed
Control Class inherited, it can implement two types of attributes:
Anchor And
Dock .
AnchorThe 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. SetAnchorIf the attribute is top and bottom, you can adjust the control vertically 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)
DockAttribute. 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. SetDockIf the property is fill, the control can be adjusted to the entire customer area filled with windows.
Me. panel1.dock = system. Windows. Forms. dockstyle. Bottom
You can also useDockpaddingObject To set the area between the 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 adjustments in earlier Visual Basic versions.Program. Most adjustment tasks can set a newAnchorAndDockAttribute.