If you are programmatically creating the label, to specify its caption, access the control's Caption property and assign the desired string to it. Here is an example: Private Sub cmdCreateControl_Click() Dim ctlFirstName As Control Set ctlFirstName = CreateControl("Exercise", _ AcControlType.acLabel, _ AcSection.acDetail, _ "Exercise") ctlFirstName.Caption = "First Name:" Set ctlFirstName = Nothing End Sub 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. There are various ways you can define the font characteristics of a control like the label. After selecting it while the form or report is in Design View, on the Ribbon, you can click Home or Design, then use the buttons in the Font section to specify the font characteristics. You can also access the Properties window of the label and modify the desired font properties. 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. If you are programmatically creating the label, to specify its size, pass a sixth argument as its left position and/or a seventh argument as its top position. Here are examples: Private Sub cmdCreateControl_Click() Dim ctlFirstName As Control Set ctlFirstName = CreateControl("Fundamentals", _ AcControlType.acLabel, _ AcSection.acDetail, _ "Exercise", _ "", _ 320, 260) ctlFirstName.Caption = "First Name:" Set ctlFirstName = Nothing End Sub The size of a label is controlled by its Width and Height properties. 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. If you are programmatically creating the label, to specify its size, pass an 8th argument as its width and/or a ninth argument as its height. Here are examples: Private Sub cmdCreateControl_Click() Dim ctlFirstName As Control Set ctlFirstName = CreateControl("Fundamentals", _ AcControlType.acLabel, _ AcSection.acDetail, _ "Exercise", _ "", _ 320, 260, 1200, 260) ctlFirstName.Caption = "First Name:" Set ctlFirstName = Nothing End Sub
|
|
|
|