drawing a target

Hi, i wrote a program in vb6.net that uses graphics paths to create a target. each ring of the target has a value and by clicking on the target i retrieve the score for that position.

my question is how can i draw a circle on top of another circle in cf which does not use graphics paths

any ideas would be appreciated

cheers




Answer this question

drawing a target

  • duffGeiger

    Graphics.DrawEllipse() is available in NETCF V2, that’s enough to draw a circle.

    You can find some formulas here: http://www.math2.org/math/geometry/circles.htm

    Look for "Equation of Circle: (Cartesian coordinates)" To see if particular X,Y is inside the circle, calculate radius from these coordinates using this formula. If calculated radius is above circle radius, coordinates are outside the circle.



  • Nikhil Ranjan Kumar

    This is my problem. If i use graphics.addellipse i can draw the circles but this does not exist in cf2. I was using the X/Y co-ordinates to get the color of the circle when using graphics path(again not in cf2).

    I tried to use math to compare the X/Y coordinates but i could not work out how to define the circle mathematically and then relate that to pixel position.

    As i type this i realize that i am exposing massive ignorance but i am new to cf2 and found this program so easy to create in vb6 that i thought it would be a good candidate for a learning experience.

    cheers

    nubie



  • mattis

    Ilya, hi

    that was exactly the help i needed!

    cheers

    nubie



  • Constantin Crstian

    Draw your circles one by one, that would create the picture. Click on that picture would give you X/Y coordinates. Next step is to use simple math to determine which circle was hit by determining if this X/Y is within particular radius. Another approach would be to get pixel from that coordinate and see which color it is. Compare this color with colors you’ve used to draw circles and you know which one is hit.



  • drawing a target