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.MouseClick
    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.DrawContent
    View.OnDrawContent(Rect)
    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.LayoutComplete
    View.LayoutSubviews()
    View.ToString()
    View.OnMouseEnter(MouseEvent)
    View.OnMouseLeave(MouseEvent)
    View.OnMouseEvent(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()

    Initializes a new instance of Label using Computed layout.
    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)

    Initializes a new instance of Label using Computed layout.
    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)

    Initializes a new instance of Label using Absolute layout.
    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)

    Initializes a new instance of Label using Absolute layout.
    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

    The text displayed by the Label.
    Declaration
    public virtual ustring Text { get; set; }
    Property Value
    Type Description
    NStack.ustring

    TextAlignment

    Controls the text-alignment 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 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)

    Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.
    Declaration
    public override void Redraw(Rect bounds)
    Parameters
    Type Name Description
    Rect bounds The bounds (view-relative region) to redraw.
    Overrides
    View.Redraw(Rect)
    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.

    Implements

    System.Collections.IEnumerable
    Back to top Generated by DocFX