WPF命中测试

 

HitTestResultBehavior.Continue 是表示继续处理更深层的交叠的视觉元素,如果改为 Stop ,则只处理最表层的视觉元素

  Point p= e.GetPosition(sender as UIElement);
            VisualTreeHelper.HitTest(this, null, f =>
            {
                tb1.Text+= f.VisualHit.ToString();
                return HitTestResultBehavior.Continue;
            }, new PointHitTestParameters(p));

 

posted @ 2020-07-01 19:32  当年小清新  阅读(195)  评论(0编辑  收藏  举报