How to draw an arc on picturebox

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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

(x,y),radius,color,start,end,aspect ratio
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...



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.