本文整理汇总了C#中System.Windows.Shapes.Ellipse.TransformToAncestor方法的典型用法代码示例。如果您正苦于以下问题:C# Ellipse.TransformToAncestor方法的具体用法?C# Ellipse.TransformToAncestor怎么用?C# Ellipse.TransformToAncestor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Shapes.Ellipse
的用法示例。
在下文中一共展示了Ellipse.TransformToAncestor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EllipseContains
public bool EllipseContains(Ellipse ellipse, System.Windows.Point location)
{
var pos = ellipse.TransformToAncestor(CanvasInfo).Transform(new System.Windows.Point(0, 0));
var center = new System.Windows.Point(pos.X + ellipse.Width / 2, pos.Y + ellipse.Height / 2);
var radiusX = ellipse.Width / 2;
var radiusY = ellipse.Height / 2;
if (radiusX <= 0.0 || radiusY <= 0.0)
return false;
var normalized = new System.Windows.Point(location.X - center.X, location.Y - center.Y);
return ((normalized.X * normalized.X) / (radiusX * radiusX)) + ((normalized.Y * normalized.Y) / (radiusY * radiusY)) <= 1.0;
}
示例2: AddMinionDebugOverlay
private void AddMinionDebugOverlay(CardEntity entity, Ellipse entityEllipse)
{
entityEllipse.Stroke = new SolidColorBrush(Colors.Red);
entityEllipse.StrokeThickness = 1;
var lbl = new Label {Content = entity.Entity.Card.Name, Foreground = Brushes.White};
_debugBoardObjects.Add(lbl);
CanvasInfo.Children.Add(lbl);
var pos = entityEllipse.TransformToAncestor(CanvasInfo).Transform(new System.Windows.Point(0, 0));
Canvas.SetTop(lbl, pos.Y + 10);
Canvas.SetLeft(lbl, pos.X + 10);
}