18. februar 2003 - 11:00
#3
jeg kan dog lige tilføje er hvis den løsning jeg har beskrevet hvor teksten kommer til at stå
s
å
d
a
n
h
e
r
men gerne vil have "lagt bogstaverne ned", så er der også en løsning på det:
ms-help://MS.NETFrameworkSDK/cpguidenf/html/_gdiplus_formatting_text_usecsharp.htm
Drawing 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.
[Visual Basic]
Dim myText As String = "Vertical text"
Dim fontFamily As New FontFamily("Lucida Console")
Dim font As New Font( _
fontFamily, _
14, _
FontStyle.Regular, _
GraphicsUnit.Point)
Dim pointF As New PointF(40, 10)
Dim stringFormat As New StringFormat()
Dim solidBrush As New SolidBrush(Color.FromArgb(255, 0, 0, 255))
stringFormat.FormatFlags = StringFormatFlags.DirectionVertical
e.Graphics.DrawString(myText, font, solidBrush, pointF, stringFormat)
[C#]
string text = "Vertical text";
FontFamily fontFamily = new FontFamily("Lucida Console");
Font font = new Font(
fontFamily,
14,
FontStyle.Regular,
GraphicsUnit.Point);
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(text, font, solidBrush, pointF, stringFormat);