I'm making a software that just displays a shape in a canvas and if the user clicks that shape , it disappears and another shape is shown and so on. My question is how can I check if the user did click on the shape ? My solution is to get the position of the object in the canvas and the mouse position relative to the canvas and check if the mouse cursor is in the range of the shape's area. but I couldn't find the way to get the position of the object in the canvas.
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in POSITION
- Hover animation resetting( seemingly reverting back to original CSS and then again to hover)when moving mouse horizontaly accross a part of an element
- How to align side text and table horizontally in R-markdown
- Limit object movement to one axis only in Powerpoint
- How to Place a "Copy to Clipboard" Icon Inside of an Input Text Box?
- WebGL Position vertex inside vertex shader?
- Calculate Velocity from Accelerometer of Android Phone
- Positioning in a ConstraintLayout
- replace NA depending on column position
- Center fixed element inside container
- change order of violin plots in ggplot2
- Connection between WindowGroup and ImmersiveSpace Entity on visionOS
- How to vertically display two divs in a row in a 'display: table' container?
- How to get x-overflowing text on a y-scrollable container
- Quaternionf and mathematic java
- How do I make several nodes line up and move up when the first one is removed? (GDscript)
Related Questions in WPF-CONTROLS
- Powershell v5 - variable name replacement when referring to WPF objects
- Custom control's name is not recognized in application's namespace
- Issues with WebView2 in WPF Usercontrol Embeded in Word VSTO CustomTaskPane
- Set button Height from a constant value defined in a class in WPF
- WPF Create a reuseable UserControl that binds to ObservableCollection<float>
- WPF custom control path,clickable background
- How to check the source of PasswordChanged event in WPF PasswordBox?
- Issues with XamlWriter
- How can I make the MediaElement not cutting off my bottom grid?
- WPF Combo box custom template for mouseover main button not dropdown items, styled in the combobox itself
- Can I inherit from MenuItem?
- Is there a way to add a handler for copy event in WPF textbox?
- WPF XAML Menu Binding in Control Template
- How to get the visible size of control after margins are applied in WPF?
- WPF VBnet comboBox dataGrid retrieve value
Related Questions in MOUSE-POSITION
- How to get mouse press position relative to QScrollArea's widget
- Why is ScreenToClient Function not working correctly?
- store the mouse position data into mongodb
- How can I change the mouse position so that an installed low-level mousehook is invoked
- how to get the mouse position in assembly
- Vim: set mouse to current cursor position
- My code does not return the proper coordinates for the cursor
- How to make element movement more responsive using e.clientX and e.clientY
- how to determine the mouse pointer is on tablelayoutpanel cell border c#
- How to make bullet launcher point in mouse position? Canvas JavaScript
- How do I instantiate a Unity prefab at the mouse's position in C#?
- Event copy/paste on mouse position
- How do I offset mouse position so that I can centre paragraphs when the user clicks?
- encoding problem when OpenLayers is loaded from web host
- How to get Mouse Position as pixel number in the text boxes
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
You can get the position on the canvas of a control by calling the Canvas.GetLeft and Canvas.GetTop methods:
But I don't think you need to do that anyway... Just handle the
MouseDownevent on the shape itself, rather than on theCanvas.