Robotics C++ Physics II AP Physics B Electronics Java Astronomy Other Courses Summer Session  

Arcs

 

 

 

Note:

 

Parameters needed to draw arcs:

  Pen

  Upper left corner of bounding rectangle (x and y)

  Width of bounding rectangle

  Height of bounding rectangle

  Start angle of arc in degrees

  End angle of arc in degrees

Angle directions when drawing arcs:

  Positive angles are swept clockwise and negative angle are swept counter clockwise without scaletransform (positive is down)

  The reverse is true with scaletransform (making positive up) 

 

Code

 

Public Class Form1

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim g As Graphics

        g = Me.CreateGraphics

        Dim pen As New Pen(Color.Red)

        g.DrawArc(pen, 100, 100, 100, 100, 0, 180)

        g.TranslateTransform(20, 350) 'move origin to this new location

        g.ScaleTransform(1.0, -1.0) 'up is now positive y direction

        g.DrawLine(pen, 0, 0, 300, 0) 'draw horizontal axis

        g.DrawLine(pen, 0, 0, 0, 300) 'draw vertical axis

        Dim pen1 As New Pen(Color.Blue)

        g.DrawArc(pen1, 100, 100, 100, 100, 0, 180)

    End Sub

End Class

 

 

 

Exercise 1

 

 

Duplicate the following