Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET WPF graphics
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 4-Jan-10 10:17am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Get the testing ellipse data and calculate your touchpoint as being on the elipse path within your allowable error margin. This will always work.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,569
1 Sergey Alexandrovich Kryukov 6,168
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 16 May 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100