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.
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.