Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleDraw transformed text in VB .NET
DescriptionThis example shows how to draw transformed text in VB .NET. The program uses the Graphics object's transformation methods and then simply calls DrawString.
Keywordstransform, transformation, text, font, VB.NET
CategoriesGraphics, VB.NET
 
The program's Paint event handler uses the Graphics object's transformation methods to define a scaling followed by a rotation. After that, everything it draws including text is transformed. The program draws a rectangle, some ellipses, and the text.
 
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
    System.Windows.Forms.PaintEventArgs) Handles _
    MyBase.Paint
    e.Graphics.ScaleTransform(1.5, 1.5, MatrixOrder.Append)
    e.Graphics.TranslateTransform(80, 20)
    e.Graphics.RotateTransform(20, MatrixOrder.Append)

    e.Graphics.DrawRectangle(Pens.Blue, 0, 0, 100, 100)
    e.Graphics.DrawEllipse(Pens.Red, -3, -3, 6, 6)
    e.Graphics.DrawEllipse(Pens.Yellow, 97, 97, 6, 6)
    Dim the_font As New Font("Times New Roman", 20, _
        FontStyle.Regular, GraphicsUnit.Pixel)
    e.Graphics.DrawString("WYSIWYG", the_font, _
        Brushes.Brown, 0, 0)
    the_font.Dispose()
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated