Draw a string vertically

S

Smokey Grindel

I want to draw a string that is at a 90 degree angle instead of left to
right it would be rotated 90 degrees... how would you go about doing this?
thanks!
 
C

Charlie Brown

I want to draw a string that is at a 90 degree angle instead of left to
right it would be rotated 90 degrees... how would you go about doing this?
thanks!

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim txt As String = "www.java2s.com"
Dim the_font As New Font("Times New Roman", 30,
FontStyle.Bold, GraphicsUnit.Pixel)
Dim layout_rect As New RectangleF(0, 0, _
Me.ClientSize.Width - 1, Me.ClientSize.Height - 1)

Dim string_format As New StringFormat
string_format.Alignment = StringAlignment.Center
string_format.LineAlignment = StringAlignment.Center
string_format.FormatFlags = _
StringFormatFlags.DirectionVertical Or _
StringFormatFlags.DirectionRightToLeft

e.Graphics.DrawString(txt, the_font, Brushes.Red, layout_rect,
string_format)
End Sub

http://www.java2s.com/Code/VB/2D/DrawStringDirectionVertical.htm
 
S

Smokey Grindel

awesome, thanks!

Charlie Brown said:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim txt As String = "www.java2s.com"
Dim the_font As New Font("Times New Roman", 30,
FontStyle.Bold, GraphicsUnit.Pixel)
Dim layout_rect As New RectangleF(0, 0, _
Me.ClientSize.Width - 1, Me.ClientSize.Height - 1)

Dim string_format As New StringFormat
string_format.Alignment = StringAlignment.Center
string_format.LineAlignment = StringAlignment.Center
string_format.FormatFlags = _
StringFormatFlags.DirectionVertical Or _
StringFormatFlags.DirectionRightToLeft

e.Graphics.DrawString(txt, the_font, Brushes.Red, layout_rect,
string_format)
End Sub

http://www.java2s.com/Code/VB/2D/DrawStringDirectionVertical.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top