API reference
Class Label
Namespace: MicroEngine.UI
Assembly: MicroEngine.UI.dll
Guide: UI widgets
Text that does nothing: a heading, a value, a hint, a line of dialogue. Lines are separated by \n; with
Wrap and a fixed Width the text also breaks between words to fit. Set
VisibleCharacters to reveal it a little at a time: the lines stay where the whole text puts them.
public sealed class Label : WidgetInheritance
Inherited Members
Widget.Measure(UiContext), Widget.Arrange(RectF, UiContext), Widget.Draw(IRenderer, UiContext), Widget.Bounds, Widget.Visible, Widget.Enabled, Widget.Width, Widget.Height, Widget.Offset, Widget.Opacity, Widget.BlocksPointer, Widget.Parent, Widget.Root, Widget.Children, Widget.Focusable, Widget.ClipsChildren, Widget.IsFocused, Widget.IsHovered, Widget.IsPressed, Widget.IsEnabledInTree, Widget.IsVisibleInTree, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
Label(string)
A label showing text.
public Label(string text = "")Parameters
text string
Properties
Color
The text’s colour; null (the default) is the theme’s text colour, or its muted colour while disabled.
public Color? Color { get; set; }Property Value
Lines
The lines the text is drawn in, after wrapping, as of the last layout.
public IReadOnlyList<string> Lines { get; }Property Value
Shadow
Whether the text has the theme’s shadow under it (true by default).
public bool Shadow { get; set; }Property Value
Text
The text; null counts as empty.
public string Text { get; set; }Property Value
VisibleCharacters
How many characters of Text are drawn, counted in the text as written (spaces and \n
included); null (the default) draws all of it. The label keeps the size and the lines of its whole text, so a
text revealed a little at a time never moves. Raise it over time for a typewriter effect.
public int? VisibleCharacters { get; set; }Property Value
int?
VisibleLines
The part of each of Lines that VisibleCharacters shows.
public IReadOnlyList<string> VisibleLines { get; }Property Value
Wrap
Whether the text breaks between words so no line is wider than the label’s fixed Width (false by default); a word wider than that on its own is broken between characters. Without a fixed width the text keeps its lines. The label grows in height to hold the lines.
public bool Wrap { get; set; }Property Value
Methods
DrawContent(IRenderer, UiContext)
Draws the widget in Bounds, and its children.
protected override void DrawContent(IRenderer renderer, UiContext context)Parameters
renderer IRenderer
context UiContext
MeasureContent(UiContext)
The size the widget’s content needs, in UI units.
protected override Vector2 MeasureContent(UiContext context)Parameters
context UiContext