Rotating Text

One addition to Microsoft .NET Compact Framework version 2.0 that is useful for working with text is support for the LogFont class, which defines the characteristics of a font for creating rotated text effects. This class is in the Microsoft.WindowsCE.Forms namespace, so you must add a reference to that assembly to use it.

The LogFont class is easy to use. Simply create a LogFont object, set properties to define the size and angle of the font, and then call the Font.FromLogFont method to return the System.Drawing.Font instance you use for drawing text. The following code shows a method you can use to do this:

using System.Drawing; using Microsoft.WindowsCE.Forms; ... private const float POINTS_PER_INCH = 72f; private Font CreateLogFont(int ...

Get Microsoft® Mobile Development Handbook 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.