Click here to Skip to main content
16,020,249 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have an Ellipse on a Canvas and I'm doing a Hit Testing on it.
Every time I click the stroke of the Ellipse, the test pass.
If I click in the middle of the Ellipse, the test fails.
This is good !
After I fill the ellipse like this: myEllipse.Fill = new SolidColorBrush(Colors.Blue);
the test pass also when I click in the middle of the Ellipse.
How can I disable this ?
(even when Ellipse is Filled, the test will fail when I click in the middle)
Thanks !
Posted

wrote:
After I fill the ellipse like this: myEllipse.Fill = new SolidColorBrush(Colors.Blue);
the test pass also when I click in the middle of the Ellipse.
How can I disable this ?


You could draw the fill with a second ellipse inside the first one. Otherwise, you can check the mouse position inside the ellipse and calculate if it's on the edge or the middle. You certainly cannot create an object, and tell it to lie to you if you ask if the mouse is over it.
 
Share this answer
 
Get the testing ellipse data and calculate your touchpoint as being on the elipse path within your allowable error margin. This will always work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900