• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Media.PointHitTestParameters类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: HitTestCore

        protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
        {
            if (IsClone)
            {
                var source = (BitmapSource)Source;

                // Get the pixel of the source that was hit
                var x = (int)(hitTestParameters.HitPoint.X / ActualWidth * source.PixelWidth);
                var y = (int)(hitTestParameters.HitPoint.Y / ActualHeight * source.PixelHeight);

                // Copy the single pixel into a new byte array representing RGBA
                var pixel = new byte[4];
                try
                {
                    source.CopyPixels(new Int32Rect(x, y, 1, 1), pixel, 4, 0);
                }
                catch { }

                // Check the alpha (transparency) of the pixel
                // - threshold can be adjusted from 0 to 255
                if (pixel[3] < 10)
                    return null;
                return new PointHitTestResult(this, hitTestParameters.HitPoint);
            }

            return base.HitTestCore(hitTestParameters);
            //return new PointHitTestResult(this, hitTestParameters.HitPoint);
        }
开发者ID:steamprodz,项目名称:DantistApp,代码行数:28,代码来源:OpaqueClickableImage.cs


示例2: HitTestCore

 protected override HitTestResult HitTestCore(PointHitTestParameters htp)
 {
     var htr = base.HitTestCore(htp);
     if (htr == null)
         htr = new PointHitTestResult(this, htp.HitPoint);
     return htr;
 }
开发者ID:hehaotian,项目名称:igt-editor,代码行数:7,代码来源:ui-part-controls.xaml.cs


示例3: HitTestCore

 //dont hit test, these are just overlay graphics
 protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
 {
     if (IsHitTestVisible)
         return base.HitTestCore(hitTestParameters);
     else
         return null;
 }
开发者ID:legendmaker,项目名称:Wpf,代码行数:8,代码来源:OverlayRenderDecorator.cs


示例4: HitTestCore

        protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
        {
            // Hit if within bounding box

            Point pt = hitTestParameters.HitPoint;

            return new PointHitTestResult(this, pt);
        }
开发者ID:csuffyy,项目名称:circuitdiagram,代码行数:8,代码来源:CircuitElementDrawingVisual.cs


示例5: HitTestCore

        protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
        {
            var alpha = GetAlphaColor(hitTestParameters.HitPoint);
            if (alpha == 0)
                return null;

            return base.HitTestCore(hitTestParameters);
        }
开发者ID:kakesu,项目名称:Procurement,代码行数:8,代码来源:AlphaHittestedImage.cs


示例6: HitTestCore

        /// <summary>
        /// Ensures that a HitTestResult is only returned for the right half of the Canvas.
        /// </summary>
        /// <param name="hitTestParameters">The HitTestParameters.</param>
        /// <returns>The PointHitTestResult, if the hit was over the right half of the Canvas,
        /// null otherwise.</returns>
        protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
        {
            Point hitPoint = hitTestParameters.HitPoint;
            if (hitPoint.X > ActualWidth / 2)
                return new PointHitTestResult(this, hitPoint);

            return null;
        }
开发者ID:HSchoenfelder,项目名称:Petedit,代码行数:14,代码来源:PartialCanvas.cs


示例7: HitTestCore

 /// <summary>
 /// Performs a hit test to determine whether the specified 
 /// points are within the bounds of this ScrollViewer
 /// </summary>
 /// <returns>The result of the hit test</returns>
 /// <param name="hitTestParameters">The parameters for hit testing within a visual object</param>
 protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
 {
     if (this.VisualChildrenCount > 0)
     {
         return VisualTreeHelper.HitTest(this.GetVisualChild(0), hitTestParameters.HitPoint);
     }
     return base.HitTestCore(hitTestParameters);
 }
开发者ID:fengyuqi,项目名称:Fluent.Ribbon,代码行数:14,代码来源:RibbonScrollViewer.cs


示例8: HitTestCore

 protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
 {
     // accept clicks even when clicking on the background
     if (TextView != null && subbed == false) {
         subbed = true;
         TextView.ScrollOffsetChanged += TextView_ScrollOffsetChanged;
     }
     return new PointHitTestResult(this, hitTestParameters.HitPoint);
 }
开发者ID:nonconforme,项目名称:UrhoAngelscriptIDE,代码行数:9,代码来源:BreakpointMargin.cs


示例9: SelectItemAt

        public void SelectItemAt(Point pt)
        {
            PointHitTestParameters param = new PointHitTestParameters(pt);

            VisualTreeHelper.HitTest(this._hitTestRoot,
                                     this.SelectHitTestFilter,
                                     this.SelectHitTestResult,
                                     param);
        }
开发者ID:habs57,项目名称:tablet-interaction,代码行数:9,代码来源:HitTestHelper.cs


示例10: HitTestCore

        protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
        {
            if (VisualTreeHelper.GetDescendantBounds(this).Contains(hitTestParameters.HitPoint))
            {
                return new PointHitTestResult(this, hitTestParameters.HitPoint);
            }

            return null;
        }
开发者ID:jonbonne,项目名称:OCTGN,代码行数:9,代码来源:CardScroller.cs


示例11: HitTestCore

        //----------------------------------------------------------------------
        //
        //  Protected Methods
        //
        //----------------------------------------------------------------------

        #region Protected Methods

        /// <summary>
        /// HitTestCore
        /// </summary>
        protected override HitTestResult HitTestCore(
            PointHitTestParameters hitTestParameters)
        {
            //
            // HostVisual never reports itself as being hit. To change this
            // behavior clients should derive from HostVisual and override
            // HitTestCore methods.
            //
            return null;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:21,代码来源:HostVisual.cs


示例12: HitTest

        public void HitTest(object sender, System.Windows.Input.MouseButtonEventArgs args)
        {
            Point mouseposition = args.GetPosition(myViewport);
            Point3D testpoint3D = new Point3D(mouseposition.X, mouseposition.Y, 0);
            Vector3D testdirection = new Vector3D(mouseposition.X, mouseposition.Y, 10);
            PointHitTestParameters pointparams = new PointHitTestParameters(mouseposition);
            RayHitTestParameters rayparams = new RayHitTestParameters(testpoint3D, testdirection);

            //test for a result in the Viewport3D
            VisualTreeHelper.HitTest(myViewport, null, HTResult, pointparams);
            UpdateTestPointInfo(testpoint3D, testdirection);
        }
开发者ID:jayawantsawant,项目名称:WPFSamples,代码行数:12,代码来源:MainWindow.xaml.cs


示例13: HitTestCore

        /// <summary>
        /// HitTestCore implements precise hit testing against render contents
        /// </summary>
        protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
        {
            if (hitTestParameters == null)
            {
                throw new ArgumentNullException("hitTestParameters");
            }

            if (_content != null)
            {                
                if (_content.HitTestPoint(hitTestParameters.HitPoint))
                {
                    return new PointHitTestResult(this, hitTestParameters.HitPoint);
                }
            }

            return null;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:20,代码来源:DrawingVisual.cs


示例14: HitTestCore

        protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
        {
            var source = (BitmapSource)Source;

            // Get the pixel of the source that was hit
            var x = (int)(hitTestParameters.HitPoint.X / ActualWidth * source.PixelWidth);
            var y = (int)(hitTestParameters.HitPoint.Y / ActualHeight * source.PixelHeight);

            if (x == source.PixelWidth) x--;
            if (y == source.PixelHeight) y--;

            var pixel = GetPixels(source)[x, y];

            if (pixel.Alpha < 5)
                return null;

            return new PointHitTestResult(this, hitTestParameters.HitPoint);
        }
开发者ID:Gravecorp,项目名称:OCTGN,代码行数:18,代码来源:OpaqueClickableImage.cs


示例15: HitTestCore

 protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
 {
     try {
         // Get value of current pixel
         var source = (BitmapSource) Source;
         var x = (int) (hitTestParameters.HitPoint.X/ActualWidth*source.PixelWidth);
         var y = (int) (hitTestParameters.HitPoint.Y/ActualHeight*source.PixelHeight);
         var pixels = new byte[4];
         source.CopyPixels(new Int32Rect(x, y, 1, 1), pixels, 4, 0);
         // Check alpha channel
         if (pixels[3] > 10) {
             return new PointHitTestResult(this, hitTestParameters.HitPoint);
         }
         else {
             return null;
         }
     }
     catch {
         return new PointHitTestResult(this, hitTestParameters.HitPoint);
     }
 }
开发者ID:fatihboy,项目名称:Robosapien,代码行数:21,代码来源:TransparentImage.cs


示例16: HitTestCore

        protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
        {
            var source = new FormatConvertedBitmap((BitmapSource) Source, PixelFormats.Bgra32, null, 0);

            // Get the pixel of the source that was hit
            var x = (int)(hitTestParameters.HitPoint.X / ActualWidth * source.PixelWidth);
            var y = (int)(hitTestParameters.HitPoint.Y / ActualHeight * source.PixelHeight);

            if (x == source.PixelWidth) x--;
            if (y == source.PixelHeight) y--;

            var pixelxy = new Int32Rect(x, y, 1, 1);
            var pixelbgra = new byte[4];

            source.CopyPixels(pixelxy, pixelbgra, source.PixelWidth * 4, 0);

            if (pixelbgra[3] < 5)
                return null;

            return new PointHitTestResult(this, hitTestParameters.HitPoint);
        }
开发者ID:rexperalta,项目名称:OCTGN,代码行数:21,代码来源:OpaqueClickableImage.cs


示例17: HitTestCore

 protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters) {
     return null;
 }
开发者ID:mmalek06,项目名称:FunkyCodeEditor,代码行数:3,代码来源:VisualElement.cs


示例18: HitTestCore

 protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
 {
     return new PointHitTestResult(this, hitTestParameters.HitPoint);
 }
开发者ID:icsharpcode,项目名称:WpfDesigner,代码行数:4,代码来源:DesignPanel.cs


示例19: HitTestCore

 protected override HitTestResult HitTestCore( PointHitTestParameters hitTestParameters )
 {
     return IsHitTestVisible ? base.HitTestCore( hitTestParameters ) : null;
 }
开发者ID:UIKit0,项目名称:AwesomiumSharp,代码行数:4,代码来源:WebControlLayer.cs


示例20: ElementUnderMouseCursor

        private DependencyObject ElementUnderMouseCursor(Point mouseCursor)
        {
            hitResultsList.Clear();
            var hitParams = new PointHitTestParameters(mouseCursor);
            VisualTreeHelper.HitTest(this, null,
                new HitTestResultCallback(DirectHitTestCallback),
                new PointHitTestParameters(mouseCursor));

            return ((hitResultsList.Count > 0) ? hitResultsList[0] : null);
        }
开发者ID:nmeek,项目名称:Dynamo,代码行数:10,代码来源:WorkspaceView.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Media.RadialGradientBrush类代码示例发布时间:2022-05-26
下一篇:
C# Media.PointCollection类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap