Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
        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));
        }