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
 
 
 
 
 
 
TitleMake a text-shaped form in VB .NET
Keywordsshaped form, text-shaped form, Region
CategoriesGraphics
 
In the form's Load event handler, create a GraphicsPath object. Use its AddString method to add the string to it.

Use the GraphicsPath to creat a Region and set the form's Region property to the result.

 
Private Sub Form1_Load(ByVal sender As Object, ByVal e As _
    System.EventArgs) Handles MyBase.Load
    Dim text_path As GraphicsPath
    Dim text_region As Region

    ' Create the text path.
    text_path = New System.Drawing.Drawing2D.GraphicsPath( _
        Drawing.Drawing2D.FillMode.Alternate)
    text_path.AddString("Flowers", _
        New FontFamily("Times New Roman"), _
        FontStyle.Bold, 200, _
        New Point(10, 10), _
        StringFormat.GenericDefault)

    ' Create a Region from the path.
    text_region = New Region(text_path)

    ' Constrain the form to the region.
    Me.Region = text_region
End Sub
 
Click here to compare this code to the version used for VB 6.
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated