VB.NET tutorial-VB.NET draw arcs

VB.NET draw arcs

To draw a curved shape can use the DrawArc() method. This method accepts four parameters. The firs parameter is the pen object. Second parameter is the rectangle object that determines the boundaries of  arc shapes. The third and fourth parameters are start angle and end angle(respectively).

Example: drawing three arcs on the form

Public Class Form1
    Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
      'Create pen objects
        Dim p As New Pen(Color.Green, 10)
        Dim p1 As New Pen(Color.Yellow, 10)
        Dim p2 As New Pen(Color.Red, 10)
        'Create rectangle objects
        Dim rt As New Rectangle(100, 150, 80, 100)
        Dim rt1 As New Rectangle(130, 120, 120, 120)
        Dim rt2 As New Rectangle(160, 100, 150, 150)
        'Draw arcs
        e.Graphics.DrawArc(p, rt, 0, -90)
        e.Graphics.DrawArc(p1, rt1, 0, -90)
        e.Graphics.DrawArc(p2, rt2, 0, -90)
    End Sub
End Class

  VB example code to draw arc


This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.