O'Reilly logo

Embedded Programming with the Microsoft® .NET Micro Framework by Rob Miles, Donald Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required