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


C# RectangleGeometry.FillContainsWithDetail方法代码示例

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


在下文中一共展示了RectangleGeometry.FillContainsWithDetail方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RectangleGeometry

 protected override GeometryHitTestResult HitTestCore
         (GeometryHitTestParameters hitTestParameters)
 {
     var geometry = new RectangleGeometry(VisualTreeHelper.GetDescendantBounds(this));
     return new GeometryHitTestResult
      (this, geometry.FillContainsWithDetail(hitTestParameters.HitGeometry));
 }
开发者ID:jonbonne,项目名称:OCTGN,代码行数:7,代码来源:CardScroller.cs

示例2: AreBoundaryIntersecting

 public override bool AreBoundaryIntersecting(FrameworkElement cursorVisual)
 {
    RectangleGeometry cursorBounds =
        new RectangleGeometry(new Rect(0, 0, cursorVisual.ActualWidth, cursorVisual.ActualHeight));
    RectangleGeometry targetBounds =
        new RectangleGeometry(new Rect(0, 0, this.ActualWidth, this.ActualHeight));
    cursorBounds.Transform = (Transform)cursorVisual.TransformToVisual(this);
    return cursorBounds.FillContainsWithDetail(targetBounds) != IntersectionDetail.Empty;
 }
开发者ID:prgoodwin,项目名称:HabilisX,代码行数:9,代码来源:MagicLens.cs

示例3: AreBoundaryIntersecting

 public override bool AreBoundaryIntersecting(FrameworkElement item)
 {
    RectangleGeometry itemBounds =
        new RectangleGeometry(new Rect(0, 0, item.ActualWidth, item.ActualHeight));
    RectangleGeometry rulerBounds =
        new RectangleGeometry(new Rect(0, 0, this.ActualWidth, this.ActualHeight));
    itemBounds.Transform = (Transform)item.TransformToVisual(this);
    return itemBounds.FillContainsWithDetail(rulerBounds) != IntersectionDetail.Empty;
 }
开发者ID:prgoodwin,项目名称:HabilisX,代码行数:9,代码来源:Ruler.cs

示例4: BoundaryIntersectingOnSide

      public int BoundaryIntersectingOnSide(FrameworkElement cursorVisual)
      {
         RectangleGeometry cursorBounds =
             new RectangleGeometry(new Rect(0, 0, cursorVisual.ActualWidth, cursorVisual.ActualHeight));
         RectangleGeometry targetBoundsTop =
             new RectangleGeometry(new Rect(0, 0, this.ActualWidth, 1));
         RectangleGeometry targetBoundsBottom =
             new RectangleGeometry(new Rect(0, this.ActualHeight-1, this.ActualWidth, 1));
         RectangleGeometry targetBoundsLeft =
             new RectangleGeometry(new Rect(0, 5, 1, this.ActualHeight-10));
         RectangleGeometry targetBoundsRight =
             new RectangleGeometry(new Rect(this.ActualWidth - 1, 5, 1, this.ActualHeight-10));


         cursorBounds.Transform = (Transform)cursorVisual.TransformToVisual(this);


         if (cursorBounds.FillContainsWithDetail(targetBoundsLeft) != IntersectionDetail.Empty)
         {
             Console.WriteLine("FOUND A LEFT");
            return LEFT;
         }
         else if (cursorBounds.FillContainsWithDetail(targetBoundsRight) != IntersectionDetail.Empty)
         {
             Console.WriteLine("FOUND A RIGHT");
            return RIGHT;
         }
         else if(cursorBounds.FillContainsWithDetail(targetBoundsTop) != IntersectionDetail.Empty)
         {
             Console.WriteLine("FOUND A TOP");
            return TOP;
         }
         else //if (cursorBounds.FillContainsWithDetail(targetBoundsBottom) != IntersectionDetail.Empty)
         {
             Console.WriteLine("FOUND A BOTTOM");
            return BOTTOM;
         }


      }
开发者ID:prgoodwin,项目名称:HabilisX,代码行数:40,代码来源:Ruler.cs

示例5: AreBoundaryIntersecting

      public override bool AreBoundaryIntersecting(FrameworkElement cursorVisual)
      {
         try
         {
            RectangleGeometry cursorBounds =
             new RectangleGeometry(new Rect(10,10, cursorVisual.ActualWidth-20, cursorVisual.ActualHeight-20));
            RectangleGeometry targetBounds =
                new RectangleGeometry(new Rect((this.ActualWidth / 4), (2 * this.ActualHeight / 3), 1, 1));
            cursorBounds.Transform = (Transform)cursorVisual.TransformToVisual(this);

            return cursorBounds.FillContainsWithDetail(targetBounds) != IntersectionDetail.Empty;
         }
         catch (Exception e) {
            Console.WriteLine("Found exception: " + e);
            return false;
         }
      }
开发者ID:prgoodwin,项目名称:HabilisX,代码行数:17,代码来源:PushPin.cs

示例6: HitTestCore

        /// <summary>
        /// HitTestCore implements whether we have hit the bounds of this visual.
        /// </summary>
        protected virtual GeometryHitTestResult HitTestCore(GeometryHitTestParameters hitTestParameters)
        {
            if (hitTestParameters == null)
            {
                throw new ArgumentNullException("hitTestParameters");
            }

            IntersectionDetail intersectionDetail;

            RectangleGeometry contentGeometry = new RectangleGeometry(GetHitTestBounds());

            intersectionDetail = contentGeometry.FillContainsWithDetail(hitTestParameters.InternalHitGeometry);
            Debug.Assert(intersectionDetail != IntersectionDetail.NotCalculated);

            if (intersectionDetail != IntersectionDetail.Empty)
            {
                return new GeometryHitTestResult(this, intersectionDetail);
            }


            return null;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:25,代码来源:Visual.cs

示例7: HitTestGeometry

        internal HitTestResultBehavior HitTestGeometry(
            HitTestFilterCallback filterCallback,
            HitTestResultCallback resultCallback,
            GeometryHitTestParameters geometryParams)
        {
            // we do not need parameter checks because they are done in HitTest()
            Geometry clip = VisualClip;
            if (clip != null)
            {
                // HitTest with a Geometry and a clip should hit test with
                // the intersection of the geometry and the clip, not the entire geometry
                IntersectionDetail intersectionDetail = clip.FillContainsWithDetail(geometryParams.InternalHitGeometry);
                
                Debug.Assert(intersectionDetail != IntersectionDetail.NotCalculated);
                if (intersectionDetail == IntersectionDetail.Empty)
                {
                    // bail out if there is a clip and this region is not inside
                    return HitTestResultBehavior.Continue;
                }
            }
            
            //
            // Check if the geometry intersects with our hittest bounds.
            // If not, the Visual is not hit-testable at all.

            if (_bboxSubgraph.IntersectsWith(geometryParams.Bounds))
            {
                //
                // Determine if there is a special filter behavior defined for this
                // Visual.
                //

                HitTestFilterBehavior filter = HitTestFilterBehavior.Continue;

                if (filterCallback != null)
                {
                    filter = filterCallback(this);

                    if (filter == HitTestFilterBehavior.ContinueSkipSelfAndChildren)
                    {
                        return HitTestResultBehavior.Continue;
                    }

                    if (filter == HitTestFilterBehavior.Stop)
                    {
                        return HitTestResultBehavior.Stop;
                    }
                }

                //
                // Hit-test against the children.
                //

                int childCount = VisualChildrenCount;

                if (filter != HitTestFilterBehavior.ContinueSkipChildren)
                {
                    for (int i=childCount-1; i>=0; i--)
                    {
                        Visual child = GetVisualChild(i);
                        if (child != null)
                        {
                            // Hit the scollClip bounds first, which are in the child's outer-space.
                            Rect? scrollClip = ScrollableAreaClipField.GetValue(child);
                            if (scrollClip.HasValue)
                            {
                                // Hit-testing with a Geometry and a clip should hit test with
                                // the intersection of the geometry and the clip, not the entire geometry
                                RectangleGeometry rectClip = new RectangleGeometry(scrollClip.Value);
                                IntersectionDetail intersectionDetail = rectClip.FillContainsWithDetail(geometryParams.InternalHitGeometry);
   
                                Debug.Assert(intersectionDetail != IntersectionDetail.NotCalculated);
                                if (intersectionDetail == IntersectionDetail.Empty)
                                {
                                    // Skip child if there is a scrollable clip and this region is not inside it.
                                    continue;
                                }
                            }
                            
                            // Transform the geometry below offset and transform.
                            Matrix inv = Matrix.Identity;
                            inv.Translate(-child._offset.X, -child._offset.Y);

                            Transform childTransform = TransformField.GetValue(child);
                            if (childTransform != null)
                            {
                                Matrix m = childTransform.Value;

                                // If we can't invert the transform, the child is not hitable. This makes sense since
                                // the node's rendered content is degnerated, i.e. does not really take up any space.
                                // Skipping the child by continuing the loop.
                                if (!m.HasInverse)
                                {
                                   continue;
                                }

                                // Inverse the transform.
                                m.Invert();

                                // Multiply the inverse and the offset together.
//.........这里部分代码省略.........
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:101,代码来源:Visual.cs


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