I wanted to run it by you just in case somebody did something similar so I don’t have to reinvent the wheel. I want to draw a circle to mark the area when I click the mouse in a position of the car. I was reading some but quite don’t get it yet. Maybe someone has a sample project I can download to see or give me some pointers?
Thank you Jeff. That worked.
Any way I can erase what i have drawn maybe by clicking on the area again? I looked it up and the last thing I saw was to reload the backdrop picture but that erases everything except for the last drawing.
You havent drawn anything permanent with my code
if you no longer wanted the circle, set the co-ordinates back to -999
I suspect that you now have a long list of questions about how to create a full-on drawing package, rather just than the original question about how to draw a circle where you click.
For example, the backdrop want mentioned in the original post.
The backdrop is the picture of the car outline I first posted. What I want the user to do is to click on the area(s) of the car and put a circle on it (which is what I did with your code). What I want is to be able for the user to erase the circle(s) should they changed their mind where they put the circle to begin with. I first though by clicking on a circle that is already drawn, if it exists, then remove it. Then I put a button to just erase everything and I though by reloading the backdrop, it would erase everything but the last circle stays there. I am sorry for all these questions, I tried to search without posting but it is still not clear to me.
if you change the currentx and currenty properties when the user clicks, the circle will move to the new position
If you dont want a circle (clearing it) , set the currentx and currenty values to -999
the original answer does all that for you.
Im sorry Jeff, I thought I understood but I am missing something. I went to save the canvas with all the selected ovals I put but it only saved the backdrop and the last oval. I know I am missing something simple like process each oval I paint.
ps. reading on your response. Right now everytime I click on different area of the canvas, it doesnt erase the previous oval but instead adds another one which is what I want so the user can select different location on the car. Let me know if you want me to post a picture of how I want to save to .png or the codes.
I want to draw a circle to mark the area when I click the mouse in a position of the car.
and my answer, assume there is one circle.
If you want several circles, you could just draw on the original image.
That doesnt allow you to erase, however, so you need to maintain both the original image plus a list of ‘circle positions’
Erasing is a process of removing one of the items from the list of positions, then redrawing again.
It is time to look at the examples, because the requirement (as I expected) was more than you asked originally, and the examples contain a fuller worked solution for you.
I am almost there. I modified the ObjectsInCanvas example to something that could work for me. The only thing that I am stuck on is how to put the backdrop. I tried adding an object which is fine but when I tried to move a particular object, I can’t because the big object gets the focus. I have included a link with the source to see if anyone can help me. The ideal will be a backdrop (and is for the vehicle outline).