Label widgets are similar to text box widgets with the exception that they are lighter objects and do not allow for editing and scrolling.
The label widget is represented by an instance of the NLabel class. The following code snippet shows how to create a label with some text:
Creating a Label |
Copy Code
|
NLabel label = new NLabel("Some Text");
|
The label object provides the following properties:
Text - specifies the text displayed by the label.
TextAlignment - specifies how text is aligned relative to the label bounding box. This property accepts values from the ENContentAlignment enum.
TextWrapMode - specifies how text is wrapped. This property accepts values from the ENTextWrapMode enum. The following table lists the available options:
ENTextWrapMode |
Description |
WordWrap |
Text is wrapped inside the formatting rectangle. |
Clip |
Text outside the formatting rectangle is clipped. |
Ellipsis |
Text that lies outside the formatting rectangle is replaced with ellipsis. |