Skip to main content

TextRun Class

NuGet: GHIElectronics.TinyCLR.UI
Assembly: GHIElectronics.TinyCLR.UI
Namespace: GHIElectronics.TinyCLR.UI.Controls

A run of text sharing a single font and color, used as a building block by TextFlow.

public class TextRun

Constructors

TextRun(string text, System.Drawing.Font font, Color foreColor)

public TextRun(string text, System.Drawing.Font font, Color foreColor)

Initializes a new text run with the given text, font, and color.

Properties

EndOfLine

public static TextRun EndOfLine { get; }

Gets a special run that marks the end of a line, forcing a line break.

Methods

GetSize(out int width, out int height)

public void GetSize(out int width, out int height)

Returns the pixel width and height of this run, computing and caching it on first use.

Fields

Text

public readonly string Text

The text of this run.

Font

public readonly System.Drawing.Font Font

The font used to draw this run.

ForeColor

public readonly Color ForeColor

The color used to draw this run.

_width

protected int _width

The cached pixel width of this run.

_height

protected int _height

The cached pixel height of this run.