A label is a user interface control which displays text or images on a form that cannot be edited by the user.
Contents |
Purpose
A label is generally used to identify a nearby text box or other widget.
Samples
The following example demonstrates the usage of a Label with HTML-Tags.
Public Sub Form_Load() Label1.Caption = "<html><u>Label</u> with <b>HTML-<font color=blue>Tags</font></b></html>" End Sub
The following example demonstrates the usage of a Label with Text and Picture.
Public Sub Form_Load() Label1.Caption = "Username:" Label1.Picture = UsergrayPng End Sub
The following example demonstrates making the background of a label control transparent. In Jabaco, if there are other controls behind the Label, those controls show through.
Private Sub MakeTransparent() Label1.BackStyle = vbTransparent End Sub
Special Events
Some controls in Jabaco have the special events MouseEnterend and MouseExited. The following example makes usage of this events to simulate a hover effect.
Public Sub Label1_MouseEntered() Label1.BorderStyle = fmBorderStyleSingle End Sub Public Sub Label1_MouseExited() Label1.BorderStyle = fmBorderStyleNone End Sub
Differences to VB6
In Visual Basic, the WordWrap property determines if text wraps to multiple lines when it is too long to fit in a label. In Jabaco, the text in a Label control automatically wraps.


