| A label control is like a text
box in that it is designed to show
text . Unlike text boxes labels are
read only meaning the label can display
text but they cannot accept text .
This also means a label cannot accept
the focus .
The text in the label is set in the
Caption property , you can make a
character in the caption an access
key by placing the & (ampersand)
in front of it . W£hen the user selects
that access key the focus is moved
to the next control in the tab order
, this is primarily used if you want
to give access keys to controls like
text boxes that do not have captions
.
Properties
| Alignment |
Appearance |
AutoSize |
BackColor |
| BackStyle |
BorderStyle |
Caption |
Container |
| DataChanged |
DataField |
DataFormat |
DataMember |
| DataSource |
DragIcon |
DragMode |
Enabled |
| Font |
FontBold |
FontItalic |
FontName |
| FontSize |
FontStrikethru |
FontUnderline |
ForeColor |
| Height |
Index |
Left |
LinkItem |
| LinkMode |
LinkNotify |
LinkTimeout |
LinkTopic |
| MouseIcon |
MousePointer |
Name |
OLEDropMode |
| Parent |
RightToLeft |
TabIndex |
Tag |
| ToolTipText |
Top |
UseMnemonic |
Visible |
| WhatsThisHelpID |
Width |
WordWrap |
|
A lot of these properties you will
not use but here are some of the most
used ones.
Name :- this is the
name of your label , the prefix is
lbl.
Caption :- this is
the actual text you will display in
your label.
BackColor/ForeColor
:- this sets the color of the background
/ and the color of the text displayed
respectively.
Font :- sets the type
of font to be used in your text.
AutoSize :- this resizes
the label to display its contents
, so the text will always fit in to
it
WordWrap :- this determines
whether a control will expand to fit
in the text , when this is set to
true and so is the AutoSize property
the label expands vertically (downwards)
but if the AutoSize is set to false
the label expands horizontally (sideways).
Events
| Change |
Click |
DblClick |
| DragOver |
LinkClose |
LinkError |
| LinkOpen |
MouseDown |
MouseMove |
| OLECompleteDrag |
OLEDragDrop |
OLEDragOver |
| LinkNotify |
MouseUp |
OLEGiveFeedback |
| OLESetData |
OLEStartDrag |
DragDrop |
These are the standard events for
controls but you will have noticed
there is no Key() events , this ties
in with a label not being able to
receive the focus.
Methods
Label control also has some methods
but you probably will never use them
, here they are ,
| Drag |
LinkExecute |
LinkPoke |
| LinkRequest |
LinkSend |
Move |
| OLEDrag |
Refresh |
ShowWhatsThis |
| ZOrder |
|
|
|