本文整理汇总了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));
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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.
//.........这里部分代码省略.........