Class Label
A simple surface for drawing text that can be moved and sized like a control.
Inherited Members
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
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
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
Overrides
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. |