|
|
Title | Use a solid brush and a wide pen in VB .NET |
Keywords | brush, fill, solid brush, solidbrush, pen, wide pen, VB.NET |
Categories | Graphics, 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
|
|
|
|
|
|