本文整理匯總了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);
}