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 a solid brush and a wide pen in VB .NET
Keywordsbrush, fill, solid brush, solidbrush, pen, wide pen, VB.NET
CategoriesGraphics, VB.NET
 
The program creates a Rectangle to define the ellipse it will draw. Then it uses the Graphics object's FillEllipse method to fil the ellipse, using a magenta SolidBrush object.

Next the program calls the Graphics object's DrawEllipse method to outline the ellipse using a new Pen that is dark magenta and 10 pixels wide.

 
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
    System.Windows.Forms.PaintEventArgs) Handles _
    MyBase.Paint
    Dim rect As New Rectangle(10, 10, _
        Me.ClientSize.Width - 20, _
        Me.ClientSize.Height - 20)

    ' Fill a rectangle with a solid magenta brush.
    e.Graphics.FillEllipse( _
        New SolidBrush(Color.Magenta), rect)

    ' Outline the rectangle with 10-pixel line.
    e.Graphics.DrawEllipse( _
        New Pen(Color.DarkMagenta, 10), rect)
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated