CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2011
    Posts
    153

    [RESOLVED] Rotating text

    The reason why I want to do this is a little much to get into, but how can I rotate text by 90 degrees?

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Rotating text

    Use Silverlight, or WPF or DirectDraw
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Rotating text

    No need for any of those....

    All you need is the DrawString method of the Drawing class.

    DO the following :

    Add 2 buttons to a new form, then type this :

    Code:
    Imports System.Drawing
    Imports System.Drawing.Drawing2D
    
    Public Class Form1
    
        Private Sub btnTopToBottom_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTopToBottom.Click
            Dim g As Graphics = Me.CreateGraphics
    
            g.TranslateTransform(50, 50)
            g.RotateTransform(-90)
            g.DrawString("Testing 1", Me.Font, New SolidBrush(Color.Black), 0, 0)
    
    
        End Sub
    
        Private Sub btnBottomToTop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBottomToTop.Click
            Dim g As Graphics = Me.CreateGraphics
    
            g.TranslateTransform(70, 50)
            g.RotateTransform(90)
            g.DrawString("Testing 2", Me.Font, New SolidBrush(Color.Azure), 0, 0)
        End Sub
    End Class
    Really not difficult at all with the built in drawing capabilities

  4. #4
    Join Date
    Mar 2011
    Posts
    153

    Re: Rotating text

    thanks! that worked!

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: [RESOLVED] Rotating text

    Cool, I'm happy that it worked.

    Good work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured