开发者

Hit Testing in WPF

I have an El开发者_开发技巧lipse on a Canvas and I'm doing Hit Testing on it. Every time I click the stroke of the Ellipse, the test passes. 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 pasess 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 !


If you do your own hit testing (see Hit Testing in the Visual Layer for details on how to do this), you should be able to check the IntersectionDetail of the GeometryHitTestResult is IntersectionDetail.Intersects, and not IntersectionDetail.FullyContains.


Cant you put a smaller ellipse in the middle of it and set IsHitTestVisible="false" ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜