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
stringThe 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
Fields
_font
The font.
protected Font _font
Field Value
_text
The text.
protected string _text
Field Value
Properties
Font
Gets or sets the font used to render the text.
public Font Font { get; set; }
Property Value
ForeColor
Gets or sets the font used to render the text.
public Color ForeColor { get; set; }
Property Value
LineHeight
Gets the height of each line of text, including any additional spacing.
public int LineHeight { get; }
Property Value
TextAlignment
Gets or sets the horizontal alignment of the text.
public TextAlignment TextAlignment { get; set; }
Property Value
TextContent
Gets or sets the text content to display.
public string TextContent { get; set; }
Property Value
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
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
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
intThe available width for the control.
availableHeight
intThe available height for the control.
desiredWidth
intThe desired width of the control.
desiredHeight
intThe desired height of the control.
OnRender(DrawingContext)
Renders the control on the specified drawing context.
public override void OnRender(DrawingContext dc)
Parameters
dc
DrawingContextThe drawing context to use for rendering.