Class Label
The Label View displays a string at a given position and supports multiple lines separted by newline characters.
Implements
System.Collections.IEnumerable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class Label : View, IEnumerable
Constructors
Label(ustring)
Initializes a new instance of Label and configures the default Width and Height based on the text, the result is suitable for Computed layout.
Declaration
public Label(ustring text)
Parameters
Type | Name | Description |
---|---|---|
NStack.ustring | text | Text. |
Label(Int32, Int32, ustring)
Initializes a new instance of Label at the given
coordinate with the given string, computes the bounding box
based on the size of the string, assumes that the string contains
newlines for multiple lines, no special breaking rules are used.
Declaration
public Label(int x, int y, ustring text)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | |
System.Int32 | y | |
NStack.ustring | text |
Label(Rect, ustring)
Initializes a new instance of Label at the given
coordinate with the given string and uses the specified
frame for the string.
Declaration
public Label(Rect rect, ustring text)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | |
NStack.ustring | text |
Properties
Text
The text displayed by the Label.
Declaration
public virtual ustring Text { get; set; }
Property Value
Type | Description |
---|---|
NStack.ustring |
TextAlignment
Controls the text-alignemtn property of the label, changing it will redisplay the Label.
Declaration
public TextAlignment TextAlignment { get; set; }
Property Value
Type | Description |
---|---|
TextAlignment | The text alignment. |
TextColor
The color used for the Label.
Declaration
public Attribute TextColor { get; set; }
Property Value
Type | Description |
---|---|
Attribute |
Methods
MaxWidth(ustring, Int32)
Computes the the max width of a line or multilines needed to render by the Label control
Declaration
public static int MaxWidth(ustring text, int width)
Parameters
Type | Name | Description |
---|---|---|
NStack.ustring | text | Text, may contain newlines. |
System.Int32 | width | The width for the text. |
Returns
Type | Description |
---|---|
System.Int32 | Max width of lines. |
MeasureLines(ustring, Int32)
Computes the number of lines needed to render the specified text by the Label view
Declaration
public static int MeasureLines(ustring text, int width)
Parameters
Type | Name | Description |
---|---|---|
NStack.ustring | text | Text, may contain newlines. |
System.Int32 | width | The width for the text. |
Returns
Type | Description |
---|---|
System.Int32 | Number of lines. |
Redraw(Rect)
Declaration
public override void Redraw(Rect region)
Parameters
Type | Name | Description |
---|---|---|
Rect | region |
Overrides
Implements
System.Collections.IEnumerable