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 and fill smooth curves in VB.NET
DescriptionThis example shows how to use antialiasing to draw and fill smooth curves in VB.NET. This example demonstrates the Graphics object's SmoothingMode property.
Keywordsantialias, alias, text, VB.NET
CategoriesGraphics, VB.NET
 
The Paint event handler calls subroutine DrawStuff to draw a polygon, ellipse, and filled ellipse. It then sets the Graphics object's SmoothingMode property to AntiAlias, translates the Graphics object so output is shifted vertically 80 pixels, and then calls subroutine DrawStuff to draw the shapes again with antialiasing.
 
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
    System.Windows.Forms.PaintEventArgs) Handles _
    MyBase.Paint
    DrawStuff(e.Graphics)

    e.Graphics.SmoothingMode = _
        Drawing2D.SmoothingMode.AntiAlias
    e.Graphics.TranslateTransform(0, 80)
    DrawStuff(e.Graphics)
End Sub

Private Sub DrawStuff(ByVal gr As Graphics)
    Dim pts() As Point = { _
        New Point(20, 10), _
        New Point(110, 30), _
        New Point(70, 60), _
        New Point(50, 40), _
        New Point(10, 70) _
    }
    gr.DrawPolygon(Pens.Black, pts)
    gr.DrawEllipse(Pens.Black, 120, 10, 100, 50)
    gr.FillEllipse(Brushes.Black, 230, 10, 100, 50)
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated