Drawing Text

The Bitmap class also provides methods to allow you to write text on the display. The character designs are expressed as font rasters, which cannot be scaled; instead, you must provide versions for each size that you require. The font raster that you wish to use can be stored as a data resource that you need to add to the project. The Font instance itself is created from a font resource:

Font myFont = Resources.GetFont(Resources.FontResources.NinaB)

This font can now be supplied to the methods that draw text in a bitmap.

Drawing Text in a Bitmap

The Bitmap class provides the DrawText method, which can be used to place text on the display at a particular position.

Font myFont = Resources.GetFont(Resources.FontResources.NinaB); myBitmap.DrawText( ...

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.