本文整理汇总了C#中System.Windows.Shapes.Rectangle.FromMidPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.FromMidPoint方法的具体用法?C# Rectangle.FromMidPoint怎么用?C# Rectangle.FromMidPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Shapes.Rectangle
的用法示例。
在下文中一共展示了Rectangle.FromMidPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToCanvas
public void AddToCanvas(Canvas canvas)
{
var rectangle = new Rectangle
{
Stroke = Brushes.Black,
Fill = Brushes.MidnightBlue
};
MakeDraggable(rectangle, relativeTo: canvas);
MouseDrag += OnMouseDrag;
canvas.Children.Add(rectangle.FromMidPoint(_midPoint, Width, Height));
}
示例2: AddToCanvas
public void AddToCanvas(Canvas canvas)
{
var flowMidPoint = new Point().AsMidPointOf(_sourceStock.MidPoint, _targetStock.MidPoint);
_sourceLine = new Line().FromPoints(_sourceStock.MidPoint, flowMidPoint, Brushes.LawnGreen);
_targetLine = new Line().FromPoints(flowMidPoint, _targetStock.MidPoint, Brushes.LawnGreen);
var flowRectangle = new Rectangle
{
Stroke = Brushes.Black,
Fill = Brushes.PaleTurquoise
};
MakeDraggable(flowRectangle, relativeTo: canvas);
MouseDrag += OnMouseDragHandler;
canvas.Children.Add(_sourceLine);
canvas.Children.Add(_targetLine);
canvas.Children.Add(flowRectangle.FromMidPoint(flowMidPoint, Width, Height));
}