|
Text-Based Controls: The Label |
|
|
A label is a control that serves as a guide to the user. It provides a static text that the user cannot change but can read to get information about another control on the form. You can also use it to display simple information to the user. Most controls on the form are not explicit at first glance and the user would not know what they are. Therefore, you can assign a label to the control as a help to the user.
To add a label to a form, on the Toolbox, click Label and click on the form or report. Type the text that the label will display and press Enter (as we will see, most controls add their own label to the form).
|
|
Probably the most important and the most obvious characteristic of a label is the text it is displaying. The text is the label's Caption. If you click the Label on the Toolbox and click on the form, you must first define its caption. If a label already has a caption, there are various ways you can edit it. For example, use the same techniques we reviewed for editing text-based properties. On the other hand, to edit the caption of a label, on the form, click inside the label. That would put it into edit mode and you can edit it as you wish.
The appearance of a label is visibly controlled by its font characteristics. The Font name, also called its face, is the name of the font as defined by the operating system. We saw that there are various ways you can define the font characteristics of a control like the label. The Formatting toolbar is equipped with appropriate combo boxes and buttons. These characteristics can also be modified using their corresponding properties from the Properties window.
The dimensions of a label control its Width and Height. Although the dimensions are closely related to the font characteristics, they can be independently defined. There are two main ways you can resize a label, which is equivalent to changing its dimensions. To set your own dimensions, in the Format tab of the Properties window of the label, change the values of the Width and Height properties. Unless you plan to show the background color of a label, probably the best way to resize a label is to make it adjust to the dimensions depending on the font size and the total characters width. To do this, position the mouse on one of the label's handle and double-click. The label's width and height would be set to accommodate its caption.
The position of a label is controlled by its Top and Left properties. The Top property defines the measure from the top left corner of the section where the label is positioned, to the top left corner of the label itself. There are two main ways you can set the position of a label. On the Properties window, you can change the values of the Top and Left properties. On the other hand, you can place your mouse on the top left corner of the label until the mouse pointer turns into a pointing finger. Then click and drag in the desired direction.
|
|
Practical Learning: Designing Labels
|
|
- Open the Video Collection1 database
- From the Forms section of the Database window, right-click the Videos1 form and click Design View
- From the Toolbox, click Label
and click in the top left section under the Header bar.
- Type Video Collection – Video Details and press Enter
- While the new label is still selected, on the Formatting toolbar, click the arrow of the
Font combo box and select Garamond
- Click the arrow of the Font Size combo box and select 20
- Click the Bold button

- Click the arrow of the Font/Fore Color button and click Yellow (column 3 - row 4).
- To resize the label, position the mouse on one of the handles surrounding the label and
double-click
- To reposition the label, on the Format property page of the Properties window, click Left, type 0.25 and press
Enter
- Change the value of the Top property to 0.040
- While the label is still selected, on the Properties window, click the Other tab
- Click Name, type lblMainTitle and press Enter
- Click anywhere on the form (to deselect the label)
- Right-click the Video Collection label and click Copy
- Right-click anywhere in the same Form Header section and click Paste
- While the new label is still selected, on the Properties window, click the All tab
- Click Name and type lblShadowTitle
- Click Left and type 0.29
- Click Top and type 0.075 and press Enter
- On the Formatting toolbar, click the arrow of Font/Fore Color and click Dark Red (1st column - 2nd row).
- On the Object combo box of the Formatting toolbar, select lblMainTitle and notice that it is selected on the form
- On the main menu, click Format -> Bring To Front
- Drag the top border of the Detail bar up completely to shrink the Form Header section until you cannot drag up anymore
- Before leaving, in the Form Header section, draw a fake line that touches both labels to select them. Then press Ctrl + C to copy
- To preview the form, on the Form View toolbar, click the View button
- On the menu bar, click Window -> Size To Fit Form:
- Close the form. When asked to save the form, click Yes.
- On the Database Window, right-click the Actors1 form and click Design View
- Right-click the area under the Form Header bar and click Paste
- While both labels are still selected, in the Properties window, click the Format tab. Change or edit the value of Caption to display Video Collection – Actors/Actresses and press Enter
- Double-click one of the handles of the labels to resize them
- Preview, save and close the form
|
|