How to draw an arc on picturebox

Posted on 2004-11-29
Last Modified: 2008-01-09
hi all,

          i have one query.

          i have a picturebox and i want to draw an arc on it.

          i have the value of center point , two end points of an arc and radius.

          can anyone help me out?

vishal patel
Question by:pmukti
    LVL 6

    Assisted Solution

    Picture1.Circle (500, 500), 500, , -0.01, -1.57, 1.5

    (x,y),radius,color,start,end,aspect ratio
    LVL 16

    Accepted Solution

    As Marv-in has suggested, you can use Picture1.Circle, if you want to create a smooth arc, given certain parameters.

    But, be aware that the 'start' and 'end' points are not co-ordinates.  Instead they are angles in radians.  Additionally, the aspect ratio is a radius multiplier.  You should look at the following program for an idea of the logic behind an ellipse:

        Private Sub Command1_Click()
            Const PI As Single = 3.141582
            x = Picture1.ScaleWidth / 2         'x = x-coord of centre
            y = Picture1.ScaleHeight / 2        'y = y-coord of centre
            r = 1000                            'r = radius
            s = PI / 4                          's = start angle
            e = PI / 2                          'e = end angle
            a = 1.5                             'a = aspect ratio
            If a < 1 Then
                w = r                           'w = actual ellipse width
                h = r * a                       'h = actual ellipse height
                h = r
                w = r / a
            End If
            sx = x + (Cos(s) * w)               'sx = actual x-coord of start of arc
            sy = y - (Sin(s) * h)               'sy = actual y-coord of start of arc
            ex = x + (Cos(e) * w)               'ex = actual x-coord of end of arc
            ey = y - (Sin(e) * h)               'ey = actual y-coord of end of arc
            Picture1.Line (x - w, y - h)-(x + w, y + h), RGB(128, 128, 128), B
                                                'box that surrounds ellipse (grey)
            Picture1.Circle (x, y), r, RGB(255, 0, 0), s, e, a
                                                'actual ellipse (red)
            Picture1.Circle (sx, sy), 25, RGB(0, 192, 0), , , 1
                                                'start point marker (green)
            Picture1.Circle (ex, ey), 25, RGB(0, 0, 192), , , 1
                                                'end point marker (blue)
        End Sub

    You can change the values of x, y, r, s, e and a to alter the ellipse/arc but you may want to give these values to the Math guys ( to get an actual coordinate derivation...



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now