Table of Contents

Class Text

Namespace
nanoFramework.Presentation.Controls
Assembly
nanoFramework.Graphics.dll

Represents a text element that can be displayed on a user interface.

public class Text : UIElement
Inheritance
Text
Inherited Members
Extension Methods

Constructors

Text()

Initializes a new instance of the Text class.

public Text()

Text(string)

Initializes a new instance of the Text class with the specified content.

public Text(string content)

Parameters

content string

The text content to display.

Text(Font, string)

Initializes a new instance of the Text class with the specified font and content.

public Text(Font font, string content)

Parameters

font Font

The font to use when rendering the text.

content string

The text content to display.

Fields

_font

The font.

protected Font _font

Field Value

Font

_text

The text.

protected string _text

Field Value

string

Properties

Font

Gets or sets the font used to render the text.

public Font Font { get; set; }

Property Value

Font

ForeColor

Gets or sets the font used to render the text.

public Color ForeColor { get; set; }

Property Value

Color

LineHeight

Gets the height of each line of text, including any additional spacing.

public int LineHeight { get; }

Property Value

int

TextAlignment

Gets or sets the horizontal alignment of the text.

public TextAlignment TextAlignment { get; set; }

Property Value

TextAlignment

TextContent

Gets or sets the text content to display.

public string TextContent { get; set; }

Property Value

string

TextWrap

Gets or sets a value indicating whether the text should be wrapped to the next line when it does not fit within the available space.

public bool TextWrap { get; set; }

Property Value

bool

Trimming

Gets or sets the text trimming behavior when the text does not fit within the available space.

public TextTrimming Trimming { get; set; }

Property Value

TextTrimming

Methods

MeasureOverride(int, int, out int, out int)

Measures the desired size of the control based on the available size and the text to display.

protected override void MeasureOverride(int availableWidth, int availableHeight, out int desiredWidth, out int desiredHeight)

Parameters

availableWidth int

The available width for the control.

availableHeight int

The available height for the control.

desiredWidth int

The desired width of the control.

desiredHeight int

The desired height of the control.

OnRender(DrawingContext)

Renders the control on the specified drawing context.

public override void OnRender(DrawingContext dc)

Parameters

dc DrawingContext

The drawing context to use for rendering.