Show / Hide Table of Contents

    Class Label

    The Label View displays a string at a given position and supports multiple lines separted by newline characters.
    Inheritance
    System.Object
    Responder
    View
    Label
    Implements
    System.Collections.IEnumerable
    Inherited Members
    View.Enter
    View.Leave
    View.MouseEnter
    View.MouseLeave
    View.Driver
    View.Subviews
    View.Id
    View.IsCurrentTop
    View.WantMousePositionReports
    View.WantContinuousButtonPressed
    View.Frame
    View.GetEnumerator()
    View.LayoutStyle
    View.Bounds
    View.X
    View.Y
    View.Width
    View.Height
    View.SuperView
    View.SetNeedsDisplay()
    View.SetNeedsDisplay(Rect)
    View.ChildNeedsDisplay()
    View.Add(View)
    View.Add(View[])
    View.RemoveAll()
    View.Remove(View)
    View.BringSubviewToFront(View)
    View.SendSubviewToBack(View)
    View.SendSubviewBackwards(View)
    View.BringSubviewForward(View)
    View.Clear()
    View.Clear(Rect)
    View.ScreenToView(Int32, Int32)
    View.ClipToBounds()
    View.SetClip(Rect)
    View.DrawFrame(Rect, Int32, Boolean)
    View.DrawHotString(ustring, Attribute, Attribute)
    View.DrawHotString(ustring, Boolean, ColorScheme)
    View.Move(Int32, Int32)
    View.PositionCursor()
    View.HasFocus
    View.OnEnter()
    View.OnLeave()
    View.Focused
    View.MostFocused
    View.ColorScheme
    View.AddRune(Int32, Int32, Rune)
    View.ClearNeedsDisplay()
    View.SetFocus(View)
    View.KeyPress
    View.ProcessKey(KeyEvent)
    View.ProcessHotKey(KeyEvent)
    View.ProcessColdKey(KeyEvent)
    View.KeyDown
    View.OnKeyDown(KeyEvent)
    View.KeyUp
    View.OnKeyUp(KeyEvent)
    View.EnsureFocus()
    View.FocusFirst()
    View.FocusLast()
    View.FocusPrev()
    View.FocusNext()
    View.LayoutSubviews()
    View.ToString()
    View.OnMouseEnter(MouseEvent)
    View.OnMouseLeave(MouseEvent)
    Responder.CanFocus
    Responder.MouseEvent(MouseEvent)
    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
    View.Redraw(Rect)

    Implements

    System.Collections.IEnumerable
    Back to top Generated by DocFX