' Simple WinForm Application to draw various arcs ' Downloaded from www.publicjoe.co.uk ' ' This software is provided 'as-is', without any express or implied warranty. ' In no event will the author(s) be held liable for any damages arising from ' the use of this software. ' ' Permission is granted to anyone to use this software for any purpose, ' including commercial applications, and to alter it and redistribute it ' freely. Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.Drawing.Drawing2D Public Class ArcDemo : Inherits Form 'Run the application Public Shared Sub Main() Application.Run(New ArcDemo()) End Sub Public Sub New() MyBase.New() Me.Text = "Arc Demo 2" Me.ClientSize = New Size(250, 200) End Sub Private Sub ArcDemo_Paint( ByVal sender As Object, _ ByVal e As PaintEventArgs) _ Handles MyBase.Paint ' Get Graphics Object Dim g As Graphics = e.Graphics ' Create Pen Dim myPen As New Pen( Color.Blue, 2 ) ' Create start and sweep angles on arc. Dim startAngle As Integer = 45 Dim sweepAngle As Integer = 180 ' Draw arc to Rectangle Dim rect As New Rectangle( 30, 30, 200, 120) myPen.DashStyle = DashStyle.Solid g.DrawArc( myPen, rect, startAngle, sweepAngle) ' Draw arc to Rectangle rect = New Rectangle( 40, 40, 180, 100) myPen.DashStyle = DashStyle.Dash g.DrawArc( myPen, rect, startAngle, sweepAngle) ' Draw arc to Rectangle rect = New Rectangle( 50, 50, 160, 80) myPen.DashStyle = DashStyle.DashDot g.DrawArc( myPen, rect, startAngle, sweepAngle) ' Now tidy up myPen.Dispose() End Sub End Class