当前位置: 首页>>代码示例>>C#>>正文


C# Media.HitTestResult类代码示例

本文整理汇总了C#中System.Windows.Media.HitTestResult的典型用法代码示例。如果您正苦于以下问题:C# HitTestResult类的具体用法?C# HitTestResult怎么用?C# HitTestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HitTestResult类属于System.Windows.Media命名空间,在下文中一共展示了HitTestResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HitTestCallback

 private HitTestResultBehavior HitTestCallback(HitTestResult result)
 {
     var rayhit = result as RayHitTestResult;
     hitTestValue = rayhit.PointHit;
     hit = true;
     return HitTestResultBehavior.Continue;
 }
开发者ID:node-net,项目名称:Node.Net,代码行数:7,代码来源:HitTester.cs

示例2: HitTest

 HitTestResultBehavior HitTest(HitTestResult ht)
 {
     var r = ht as RayMeshGeometry3DHitTestResult;
     if (r == null) return HitTestResultBehavior.Continue;
     svr.Move(bFirst, r.PointHit.X < (svr.BarPos(bFirst) - 0.5 + barRate / 2) * 300);
     return HitTestResultBehavior.Stop;
 }
开发者ID:SaitoTsutomu,项目名称:TemnnisGame,代码行数:7,代码来源:Window1.xaml.cs

示例3: ResultCallBack

        public HitTestResultBehavior ResultCallBack(HitTestResult result)
        {
            // Did we hit 3D?
            RayHitTestResult rayResult = result as RayHitTestResult;
            if (rayResult != null)
            {
                // Did we hit a MeshGeometry3D?
                RayMeshGeometry3DHitTestResult rayMeshResult =
                    rayResult as RayMeshGeometry3DHitTestResult;

                if (rayMeshResult != null)
                {
                    GeometryModel3D hitgeo = rayMeshResult.ModelHit as GeometryModel3D;
                    DiffuseMaterial dm = hitgeo.Material as DiffuseMaterial;
                    SolidColorBrush b = dm.Brush as SolidColorBrush;
                    Color c = b.Color;
                    c.ScB = 1 - c.ScB;
                    c.ScG = 1 - c.ScG;
                    c.ScR = 1 - c.ScR;
                    hitgeo.Material = new DiffuseMaterial(new SolidColorBrush(c));
                }
            }

            return HitTestResultBehavior.Continue;
        }
开发者ID:QueueHammer,项目名称:WPF3DGrid,代码行数:25,代码来源:MainWindow.xaml.cs

示例4: SelectModel

        private HitTestResultBehavior SelectModel(HitTestResult result)
        {
            RayHitTestResult res = result as RayHitTestResult;
            if (res != null)
            {
                DependencyObject visual = res.VisualHit;
                object model = null, scene = null;
                while (visual != null)
                {
                    if (consoleMode)
                    {
                        if (visual is Model)
                            scope.SetVariable("model", model = visual);
                        else if (visual is Scene)
                            scope.SetVariable("scene", scene = visual);
                    }
                    else
                        Control.SendClick(visual, result);
                    visual = VisualTreeHelper.GetParent(visual);
                }
                selection.Text = $"Selection: {model} in {scene}";
            }

            return HitTestResultBehavior.Stop;
        }
开发者ID:danzhu,项目名称:JoyfulColours,代码行数:25,代码来源:MainWindow.xaml.cs

示例5: MainHitTestResult

 public HitTestResultBehavior MainHitTestResult(HitTestResult result)
 {
     if ((result.VisualHit as DrawingVisual) != null)
     {
         hittedElements.Add(result.VisualHit as DrawingVisual);
     }
     return HitTestResultBehavior.Continue;
 }
开发者ID:dimapereverzev,项目名称:pipeline_editor,代码行数:8,代码来源:DrawingSurface.cs

示例6: InfoHitTestSelOneResultCallback

        HitTestResultBehavior InfoHitTestSelOneResultCallback(HitTestResult result) {
            var frameworkElement = result.VisualHit as FrameworkElement;

            if (frameworkElement == null)
                return HitTestResultBehavior.Continue;

            _infoShape = frameworkElement;
            return HitTestResultBehavior.Stop;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:9,代码来源:HitTestHandler.cs

示例7: RailHitTestSelOneResultCallback

        HitTestResultBehavior RailHitTestSelOneResultCallback(HitTestResult result) {
            var frameworkElement = result.VisualHit as FrameworkElement;

            if (frameworkElement == null || !(frameworkElement.Tag is Rail))
                return HitTestResultBehavior.Continue;

            _railUnderMouse = frameworkElement.Tag as Rail;
            return HitTestResultBehavior.Stop;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:9,代码来源:HitTestHandler.cs

示例8: MyCallback

        // If a child visual object is hit, toggle its opacity to visually indicate a hit.
        public HitTestResultBehavior MyCallback(HitTestResult result)
        {
            if (result.VisualHit.GetType() == typeof (System.Windows.Media.DrawingVisual))
            {
                ((System.Windows.Media.DrawingVisual) result.VisualHit).Opacity =
                    ((System.Windows.Media.DrawingVisual) result.VisualHit).Opacity == 1.0 ? 0.4 : 1.0;
            }

            // Stop the hit test enumeration of objects in the visual tree.
            return HitTestResultBehavior.Stop;
        }
开发者ID:ClemensT,项目名称:WPF-Samples,代码行数:12,代码来源:MyVisualHost.cs

示例9: PerformHitTest

 // Return the result of the hit test to the callback.
 public HitTestResultBehavior PerformHitTest(HitTestResult result)
 {
     FrameworkElement visual = (FrameworkElement)result.VisualHit;
     // Add the hit test result to the list that will be processed after the enumeration.
     if (visual.IsHitTestVisible)
         hitTestResults.Add(visual);
     else
         return HitTestResultBehavior.Stop;
     // Set the behavior to return visuals at all z-order levels.
     return HitTestResultBehavior.Continue;
 }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:12,代码来源:GazeTouchViewer.xaml.cs

示例10: HitTestCallback

 private HitTestResultBehavior HitTestCallback(HitTestResult result)
 {
     GeometryHitTestResult geometryResult = (GeometryHitTestResult)result;
     DrawingVisual visual = result.VisualHit as DrawingVisual;
     if (visual != null &&
         geometryResult.IntersectionDetail == IntersectionDetail.FullyInside)
     {
         hits.Add(visual);
     }
     return HitTestResultBehavior.Continue;
 }
开发者ID:ittray,项目名称:LocalDemo,代码行数:11,代码来源:DrawingCanvas.cs

示例11: OnVisualHit

        protected HitTestResultBehavior OnVisualHit(HitTestResult result)
        {
            foreach (NameValuePair nvp in dataPoints)
            {
                if (nvp.Tag == result.VisualHit)
                {
                    MessageBox.Show("Name: " + nvp.Name + ", Value: " + nvp.Value.ToString());
                    break;
                }
            }

            return HitTestResultBehavior.Continue;
        }
开发者ID:ngbrown,项目名称:WPFinAction,代码行数:13,代码来源:ColumnGraphVisualCtrl.cs

示例12: CircleHitTestResult

        // Handle the hit test results enumeration in the callback.
        internal static HitTestResultBehavior CircleHitTestResult(HitTestResult result)
        {
            // Add the hit test result to the list that will be processed after the enumeration.
            HitResultsList.Add(result.VisualHit);

            // Determine whether hit test should return only the top-most layer visual.
            if (MyWindow.TopmostLayer)
            {
                // Set the behavior to stop the enumeration of visuals.
                return HitTestResultBehavior.Stop;
            }
            // Set the behavior to continue the enumeration of visuals.
            // All visuals that intersect at the hit test coordinates are returned,
            // whether visible or not.
            return HitTestResultBehavior.Continue;
        }
开发者ID:ClemensT,项目名称:WPF-Samples,代码行数:17,代码来源:MyShape.cs

示例13: MyHitTestResult

        // Return the result of the hit test to the callback. 
        public HitTestResultBehavior MyHitTestResult(HitTestResult result)
        {
            if (result.VisualHit is FrameworkElement)
            {
                if (((FrameworkElement) result.VisualHit).DataContext is Appraisal)
                {
                    hitResultsList.Add(((FrameworkElement)result.VisualHit).DataContext as Appraisal);
                }
            }
                
            // Add the hit test result to the list that will be processed after the enumeration.
            

            // Set the behavior to return visuals at all z-order levels. 
            return HitTestResultBehavior.Stop;
        }
开发者ID:TNOCS,项目名称:csTouch,代码行数:17,代码来源:CenteredSurfaceListBox.cs

示例14: myCallback

        // If a child visual object is hit, toggle its opacity to visually indicate a hit.
        public HitTestResultBehavior myCallback(HitTestResult result)
        {
            if (result.VisualHit.GetType() == typeof(DrawingVisual))
            {
                if (((DrawingVisual)result.VisualHit).Opacity == 1.0)
                {
                    ((DrawingVisual)result.VisualHit).Opacity = 0.4;
                }
                else
                {
                    ((DrawingVisual)result.VisualHit).Opacity = 1.0;
                }
            }

            // Stop the hit test enumeration of objects in the visual tree.
            return HitTestResultBehavior.Stop;
        }
开发者ID:rugbbyli,项目名称:ShudooCalc,代码行数:18,代码来源:MyVisualHost.cs

示例15: myCallback

        public HitTestResultBehavior myCallback(HitTestResult result)
        {
            // Toggle between a skewed rendering and normal rendering,
            // if a visual was clicked.
            if (result.VisualHit.GetType() == typeof(DrawingVisual))
            {
                if (((DrawingVisual)result.VisualHit).Transform == null)
                {
                    ((DrawingVisual)result.VisualHit).Transform = new SkewTransform(7, 7);
                }
                else
                {
                    ((DrawingVisual)result.VisualHit).Transform = null;
                }
            }

            // Tell HitTest() to stop drilling into the visual tree.
            return HitTestResultBehavior.Stop;
        }
开发者ID:usedflax,项目名称:flaxbox,代码行数:19,代码来源:CustomVisualFrameworkElement.cs


注:本文中的System.Windows.Media.HitTestResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。