Label Class
Definition
Section titled “Definition”A simple surface for drawing text that can be moved and sized like a control.
[DataContract]public class Label : ControlBaseInheritance object → ControlBase
Constructors
Section titled “Constructors”Label(string)
Section titled “Label(string)”A control to display simple one-line text.
public Label(string displayText)Parameters
Section titled “Parameters”displayText string
The text to display. Sets the width based on the length.
Label(int)
Section titled “Label(int)”A control to display simple one-line text.
public Label(int length)Parameters
Section titled “Parameters”length int
The initial length of the label without any text.
Properties
Section titled “Properties”ShowUnderline
Section titled “ShowUnderline”When true, shows an underline on the text.
public bool ShowUnderline { get; set; }ShowStrikethrough
Section titled “ShowStrikethrough”When true, shows a strikethrough on the text.
public bool ShowStrikethrough { get; set; }TextColor
Section titled “TextColor”Optional text color for the label. Otherwise the theme controls the color.
public Color? TextColor { get; set; }Alignment
Section titled “Alignment”Sets the horizontal alignment of the label. Defaults to Left.
public HorizontalAlignment Alignment { get; set; }DisplayText
Section titled “DisplayText”The text to display on the label. The label size is set in the constructor and cannot be changed.
public string DisplayText { get; set; }UseNormalStateOnly
Section titled “UseNormalStateOnly”When true, only uses Normal for drawing.
[DataMember]public bool UseNormalStateOnly { get; set; }DecoratorUnderline
Section titled “DecoratorUnderline”The decorator to use when the ShowUnderline is true.
[DataMember]public CellDecorator DecoratorUnderline { get; set; }DecoratorStrikethrough
Section titled “DecoratorStrikethrough”The decorator to use when the ShowStrikethrough is true.
[DataMember]public CellDecorator DecoratorStrikethrough { get; set; }Methods
Section titled “Methods”Resize(int, int)
Section titled “Resize(int, int)”Resizes the label but forces a height of 1.
public override void Resize(int width, int height)Parameters
Section titled “Parameters”width int
The width of the label.
height int
Not used.
UpdateAndRedraw(TimeSpan)
Section titled “UpdateAndRedraw(TimeSpan)”Redraws the control if applicable.
public override void UpdateAndRedraw(TimeSpan time)Parameters
Section titled “Parameters”time TimeSpan
The duration of thecurrent frame.
GetStrikethrough(IFont, Color)
Section titled “GetStrikethrough(IFont, Color)”Gets the strikethrough glyph defined by a font. If not found, returns glyph 196.
protected CellDecorator GetStrikethrough(IFont font, Color color)Parameters
Section titled “Parameters”font IFont
The font.
color SadRogue.Primitives.Color
The color to shade the decorator.
Returns
Section titled “Returns”CellDecorator
The cell decorator.
GetUnderline(IFont, Color)
Section titled “GetUnderline(IFont, Color)”Gets the underline glyph defined by a font. If not found, returns glyph 95.
protected CellDecorator GetUnderline(IFont font, Color color)Parameters
Section titled “Parameters”font IFont
The font.
color SadRogue.Primitives.Color
The color to shade the decorator.
Returns
Section titled “Returns”CellDecorator
The cell decorator.