Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Create Vertical Text

You can use a StringFormat object to specify that text be drawn vertically rather than horizontally.

The following example assigns the value DirectionVertical to the FormatFlags property of a StringFormat object. That StringFormat object is passed to the DrawString method of the Graphics class. The value DirectionVertical is a member of the StringFormatFlags enumeration.

The following illustration shows the vertical text.

Fonts Text
string myText = "Vertical text";

FontFamily fontFamily = new FontFamily("Lucida Console");
Font font = new Font(
PointF pointF = new PointF(40, 10);
StringFormat stringFormat = new StringFormat();
SolidBrush solidBrush = new SolidBrush(Color.FromArgb(255, 0, 0, 255));

stringFormat.FormatFlags = StringFormatFlags.DirectionVertical;

e.Graphics.DrawString(myText, font, solidBrush, pointF, stringFormat); 

Community Additions

© 2015 Microsoft