Show / Hide Table of Contents

Class Label

A simple surface for drawing text that can be moved and sized like a control.

Inheritance
object
ControlBase
Label
Inherited Members
ControlBase.MouseState_IsMouseOver
ControlBase.MouseState_EnteredWithButtonDown
ControlBase.MouseState_IsMouseLeftDown
ControlBase.MouseState_IsMouseRightDown
ControlBase.OnUnfocused()
ControlBase.OnFocused()
ControlBase.OnIsDirtyChanged()
ControlBase.ProcessKeyboard(Keyboard)
ControlBase.ProcessMouse(MouseScreenObjectState)
ControlBase.LostMouse(MouseScreenObjectState)
ControlBase.OnParentChanged()
ControlBase.OnPositionChanged()
ControlBase.PlaceRelativeTo(ControlBase, Direction.Types, int)
ControlBase.DetermineState()
ControlBase.OnStateChanged(ControlStates, ControlStates)
ControlBase.OnSurfaceChanged(ICellSurface, ICellSurface)
ControlBase.FindThemeFont()
ControlBase.FindThemeColors()
ControlBase.SetThemeColors(Colors)
ControlBase.HasThemeColors()
ControlBase.OnResized()
ControlBase.CreateControlSurface()
ControlBase.RefreshThemeStateColors(Colors)
ControlBase.OnMouseEnter(ControlBase.ControlMouseState)
ControlBase.OnMouseExit(ControlBase.ControlMouseState)
ControlBase.OnMouseIn(ControlBase.ControlMouseState)
ControlBase.OnLeftMouseClicked(ControlBase.ControlMouseState)
ControlBase.OnRightMouseClicked(ControlBase.ControlMouseState)
ControlBase.ThemeState
ControlBase.UseKeyboard
ControlBase.UseMouse
ControlBase.CanFocus
ControlBase.CanResize
ControlBase.AlternateFont
ControlBase.Surface
ControlBase.MouseArea
ControlBase.IsMouseButtonStateClean
ControlBase.Position
ControlBase.AbsolutePosition
ControlBase.IsVisible
ControlBase.Tag
ControlBase.TabStop
ControlBase.TabIndex
ControlBase.IsDirty
ControlBase.Name
ControlBase.FocusOnMouseClick
ControlBase.Width
ControlBase.Height
ControlBase.IsFocused
ControlBase.IsEnabled
ControlBase.Bounds
ControlBase.Parent
ControlBase.State
ControlBase.IsDirtyChanged
ControlBase.Focused
ControlBase.Unfocused
ControlBase.PositionChanged
ControlBase.MouseEnter
ControlBase.MouseExit
ControlBase.MouseMove
ControlBase.MouseButtonClicked
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.UI.Controls
Assembly: SadConsole.dll
Syntax
[DataContract]
public class Label : ControlBase

Constructors

Label(int)

A control to display simple one-line text.

Declaration
public Label(int length)
Parameters
Type Name Description
int length

The initial length of the label without any text.

Label(string)

A control to display simple one-line text.

Declaration
public Label(string displayText)
Parameters
Type Name Description
string displayText

The text to display. Sets the width based on the length.

Properties

Alignment

Sets the horizontal alignment of the label. Defaults to Left.

Declaration
public HorizontalAlignment Alignment { get; set; }
Property Value
Type Description
HorizontalAlignment

DecoratorStrikethrough

The decorator to use when the ShowStrikethrough is true.

Declaration
[DataMember]
public CellDecorator DecoratorStrikethrough { get; set; }
Property Value
Type Description
CellDecorator

DecoratorUnderline

The decorator to use when the ShowUnderline is true.

Declaration
[DataMember]
public CellDecorator DecoratorUnderline { get; set; }
Property Value
Type Description
CellDecorator

DisplayText

The text to display on the label. The label size is set in the constructor and cannot be changed.

Declaration
public string DisplayText { get; set; }
Property Value
Type Description
string

ShowStrikethrough

When true, shows a strikethrough on the text.

Declaration
public bool ShowStrikethrough { get; set; }
Property Value
Type Description
bool

ShowUnderline

When true, shows an underline on the text.

Declaration
public bool ShowUnderline { get; set; }
Property Value
Type Description
bool

TextColor

Optional text color for the label. Otherwise the theme controls the color.

Declaration
public Color? TextColor { get; set; }
Property Value
Type Description
Color?

UseNormalStateOnly

When true, only uses Normal for drawing.

Declaration
[DataMember]
public bool UseNormalStateOnly { get; set; }
Property Value
Type Description
bool

Methods

GetStrikethrough(IFont, Color)

Gets the strikethrough glyph defined by a font. If not found, returns glyph 196.

Declaration
protected CellDecorator GetStrikethrough(IFont font, Color color)
Parameters
Type Name Description
IFont font

The font.

Color color

The color to shade the decorator.

Returns
Type Description
CellDecorator

The cell decorator.

GetUnderline(IFont, Color)

Gets the underline glyph defined by a font. If not found, returns glyph 95.

Declaration
protected CellDecorator GetUnderline(IFont font, Color color)
Parameters
Type Name Description
IFont font

The font.

Color color

The color to shade the decorator.

Returns
Type Description
CellDecorator

The cell decorator.

Resize(int, int)

Resizes the label but forces a height of 1.

Declaration
public override void Resize(int width, int height)
Parameters
Type Name Description
int width

The width of the label.

int height

Not used.

Overrides
ControlBase.Resize(int, int)

UpdateAndRedraw(TimeSpan)

Redraws the control if applicable.

Declaration
public override void UpdateAndRedraw(TimeSpan time)
Parameters
Type Name Description
TimeSpan time

The duration of thecurrent frame.

Overrides
ControlBase.UpdateAndRedraw(TimeSpan)

Extension Methods

ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX