How can one get the coordinates of a mouse click inside a panel?
For instance I want to be able to put pixels wherever I click with my mouse. I can handle the drawing part, but I don’t know how to make my program to listen for that click event, and how to get x/y coordinates of it so it can draw in right place.
I never saw a similar piece of code, and I was unable to find relevant information with google so I can’t show any code “how I tried to achieve that” because I simply didn’t :/ I have no clue how to start. I am probably searching the wrong keywords, but I am sure that it can be done.
EDIT: Thank you all
Here is a complete hint for your question, with code. For the panel you can use the
mouseDownevent. And from the event arguments you can get the coords.