Class Label
Implements
Inherited Members
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class Label : View, IEnumerable
Constructors
Label()
Declaration
public Label()
Remarks
The Label will be created using Computed coordinates. The initial size (Frame will be adjusted to fit the contents of Text, including newlines ('\n') for multiple lines.
No line wraping is provided.
Label(ustring)
Declaration
public Label(ustring text)
Parameters
| Type | Name | Description |
|---|---|---|
| NStack.ustring | text | text to initialize the Text property with. |
Remarks
The Label will be created using Computed coordinates with the given string. The initial size (Frame will be adjusted to fit the contents of Text, including newlines ('\n') for multiple lines.
No line wraping is provided.
Label(Int32, Int32, ustring)
Declaration
public Label(int x, int y, ustring text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | column to locate the Label. |
| System.Int32 | y | row to locate the Label. |
| NStack.ustring | text | text to initialize the Text property with. |
Remarks
The Label will be created at the given coordinates with the given string. The size (Frame will be adjusted to fit the contents of Text, including newlines ('\n') for multiple lines.
No line wraping is provided.
Label(Rect, ustring)
Declaration
public Label(Rect rect, ustring text)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | rect | Location. |
| NStack.ustring | text | text to initialize the Text property with. |
Remarks
The Label will be created at the given coordinates with the given string. The initial size (Frame will be adjusted to fit the contents of Text, including newlines ('\n') for multiple lines.
No line wraping is provided.
Properties
Text
Declaration
public virtual ustring Text { get; set; }
Property Value
| Type | Description |
|---|---|
| NStack.ustring |
TextAlignment
Declaration
public TextAlignment TextAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlignment | The text alignment. |
TextColor
Declaration
public Attribute TextColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Attribute |
Methods
MaxWidth(ustring, Int32)
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)
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 bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | bounds | The bounds (view-relative region) to redraw. |
Overrides
Remarks
Always use Bounds (view-relative) when calling Redraw(Rect), NOT Frame (superview-relative).
Views should set the color that they want to use on entry, as otherwise this will inherit the last color that was set globaly on the driver.
Overrides of Redraw(Rect) must ensure they do not set Driver.Clip to a clip region
larger than the region parameter.