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
 
 
 
 
 
TitleUse antialiasing to draw smooth text in VB.NET
DescriptionThis example shows how to use antialiasing to draw smooth text in VB.NET. This example demonstrates the Graphics object's TextRenderingHint property.
Keywordsantialias, alias, text, VB.NET
CategoriesGraphics, VB.NET
 
The program sets the Graphics's object's TextRenderingHint property to AntiAliasGridFit and then draws the text. This property can take some other values that give different kinds of antialiasing, although this value seems to produce the best result.
 
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
    System.Windows.Forms.PaintEventArgs) Handles _
    MyBase.Paint
    Dim big_font As New Font("Times New Roman", 60, _
        FontStyle.Bold, GraphicsUnit.Pixel)
    e.Graphics.DrawString("Antialiasing Off", _
        big_font, Brushes.Black, 10, 10)

    e.Graphics.TextRenderingHint = _
        TextRenderingHint.AntiAliasGridFit
    e.Graphics.DrawString("Antialiasing On", _
        big_font, Brushes.Black, 10, 80)
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated