Displaying Text
The Text
class is based on the UIElement
class, but adds properties and methods to manage the text that it is to display. We have already seen the Text element in our examples; now it is time to examine how it works a little more closely.
The Text
element uses a Font
to render the text. The font resource is exactly the same as that used to render text using the Bitmap
class. These are loaded and assigned to a particular text element. You can use different fonts for different text elements, depending on your requirements.
Text text = new Text(); Font ninaB = Resources.GetFont(Resources.FontResources.NinaB); text.Font = ninaB;
You can also select the alignment and wrapping behavior of the text.
text.TextWrap = true; text.TextAlignment ...
Get Embedded Programming with the Microsoft® .NET Micro Framework now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.