Show / Hide Table of Contents

# Class Label

Label view, displays a string at a given position, can include multiple lines.

##### Inheritance

System.Object
Responder
View
Label

##### Inherited Members

Responder.CanFocus
Responder.MouseEvent(MouseEvent)
View.Add(View)
View.Add(View[])
View.AddRune(Int32, Int32, Rune)
View.Bounds
View.ChildNeedsDisplay()
View.Clear()
View.Clear(Rect)
View.ClearNeedsDisplay()
View.ClipToBounds()
View.ColorScheme
View.DrawFrame(Rect, Int32, Boolean)
View.DrawHotString(ustring, Boolean, ColorScheme)
View.DrawHotString(ustring, Attribute, Attribute)
View.Driver
View.EnsureFocus()
View.Focused
View.FocusFirst()
View.FocusLast()
View.FocusNext()
View.FocusPrev()
View.Frame
View.GetEnumerator()
View.HasFocus
View.Height
View.Id
View.LayoutStyle
View.LayoutSubviews()
View.MostFocused
View.Move(Int32, Int32)
View.PositionCursor()
View.ProcessColdKey(KeyEvent)
View.ProcessHotKey(KeyEvent)
View.ProcessKey(KeyEvent)
View.Remove(View)
View.RemoveAll()
View.ScreenToView(Int32, Int32)
View.SetClip(Rect)
View.SetFocus(View)
View.SetNeedsDisplay()
View.SetNeedsDisplay(Rect)
View.Subviews
View.SuperView
View.ToString()
View.WantMousePositionReports
View.Width
View.X
View.Y

###### Namespace: Terminal.Gui

###### Assembly: Terminal.Gui.dll

##### Syntax

    public class Label : Terminal.Gui.View

### Constructors

#### Label(ustring)

Public constructor: creates a label and configures the default Width and Height based on the text, the result is suitable for Computed layout.

##### Declaration

    public Label (NStack.ustring text);

##### Parameters

Type | Name | Description
--- | --- | ---
NStack.ustring | text | Text.

#### Label(Rect, ustring)

Public constructor: creates a label at the given coordinate with the given string and uses the specified frame for the string.

##### Declaration

    public Label (Terminal.Gui.Rect rect, NStack.ustring text);

##### Parameters

Type | Name | Description
--- | --- | ---
Rect | rect | To be added.
NStack.ustring | text | To be added.

#### Label(Int32, Int32, ustring)

Public constructor: creates a 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, NStack.ustring text);

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | x | To be added.
System.Int32 | y | To be added.
NStack.ustring | text | To be added.

### Properties

#### Text

The text displayed by this widget.

##### Declaration

    public virtual NStack.ustring Text { get; set; }

##### Property Value

Type | Description
--- | ---
NStack.ustring | To be added.

#### TextAlignment

Controls the text-alignemtn property of the label, changing it will redisplay the label.

##### Declaration

    public Terminal.Gui.TextAlignment TextAlignment { get; set; }

##### Property Value

Type | Description
--- | ---
TextAlignment | The text alignment.

#### TextColor

The color used for the label

##### Declaration

    public Terminal.Gui.Attribute TextColor { get; set; }

##### Property Value

Type | Description
--- | ---
Attribute | To be added.

### 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 (NStack.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 control

##### Declaration

    public static int MeasureLines (NStack.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 (Terminal.Gui.Rect region);

##### Parameters

Type | Name | Description
--- | --- | ---
Rect | region | To be added.