Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class DrawPieDemo
public Shared Sub Main
Application.Run(New FrmArcTest)
End Sub
End class
Public Class FrmArcTest
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.Container
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'frmArcTest
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.SystemColors.ControlLight
Me.ClientSize = New System.Drawing.Size(292, 221)
Me.Name = "frmArcTest"
Me.Text = "Drawing Arcs"
End Sub
#End Region
Protected Overrides Sub OnPaint( _
ByVal paintEvent As PaintEventArgs)
Dim graphicsObject As Graphics = paintEvent.Graphics
Dim rectangle1 As Rectangle = New Rectangle(15, 35, 80, 80)
Dim brush1 As SolidBrush = New SolidBrush(Color.Firebrick)
Dim pen1 As Pen = New Pen(brush1, 1)
Dim brush2 As SolidBrush = New SolidBrush(Color.DarkBlue)
Dim pen2 As Pen = New Pen(brush2, 1)
' start at 0 and sweep 360 degrees
graphicsObject.DrawArc(pen2, rectangle1, 0, 360)
' start at 0 and sweep -270 degrees
rectangle1.Location = New Point(185, 35)
graphicsObject.DrawArc(pen2, rectangle1, 0, -270)
End Sub
End Class
|