Database Reference
In-Depth Information
Take a look at Figure 9-13, which shows a resized (height and width) form and the position of the
controls. The controls appear in the top-left corner because their Dock property values are None and
their Anchor property values are Top, Left.
Figure 9-13. Resized form and position of controls
Now you will try to set the Dock and Anchor properties for the controls and then retest the
application.
4. Select the Label control named lbl Welcome, and set the Text value to
Welcome. Go to the Properties window. Select the AutoSize property, and set
its value to False (default value is True).
5. Resize the width of the Label control to the width of the form, and adjust the
Label control to the top border of the form. Set this control's TextAlign
property to Top, Center.
6. Set the Dock property for the Label control from None to Top, which means
you want the label to always be affixed with the top border of the form.
7. Now select all the remaining controls (two Labels, two TextBoxes, and one
Button) either by scrolling over all of them while holding down the left mouse
button or by selecting each with a click while pressing down either the Shift or
Ctrl key.
8. Once you have selected all the controls, go to the Properties window. You will
see listed all the properties common to the controls you have selected on the
form.
9. Select the Anchor property; modify its value from the default Top, Left to Top,
Left, and Right. This will allow you to adjust the controls accordingly as soon as
you resize the form. The controls will also grow in size accordingly to adjust to
the width of the form, as you can see in Figure 9-14.
 
Search WWH ::




Custom Search