Example #1
0
        /// <summary>
        /// 复制
        /// </summary>
        private void Copy_Click(object sender, RoutedEventArgs e)
        {
            if (_selectedShape != null)
            {
                ShapeBase shape = _selectedShape.Clone();

                shape.Draw();
                _diagram.Add(shape);

                _canvasInitTop  = _selectedShape.Top + 10;
                _canvasInitLeft = _selectedShape.Left + 10;
                shape.Instance.SetValue(Canvas.TopProperty, _canvasInitTop);
                shape.Instance.SetValue(Canvas.LeftProperty, _canvasInitLeft);

                shape.Instance.MouseLeftButtonDown += ShapeInstance_MouseLeftButtonDown;
                shape.Instance.MouseLeftButtonUp   += ShapeInstance_MouseLeftButtonUp;
                shape.Instance.MouseMove           += ShapeInstance_MouseMove;

                shape.Instance.MouseLeftButtonUp += ShapeInstance_MouseLeftButtonUp;

                Stage.Children.Add(shape.Instance);
            }
            else
            {
                Status.Content = "请选择要复制的图形!";
            }
        }
Example #2
0
        private void DrawOnStage(ShapeBase shape)
        {
            shape.Draw();
            _diagram.Add(shape);
            shape.Instance.SetValue(Canvas.TopProperty, shape.Top);
            shape.Instance.SetValue(Canvas.LeftProperty, shape.Left);

            shape.Instance.MouseLeftButtonDown += ShapeInstance_MouseLeftButtonDown;
            shape.Instance.MouseLeftButtonUp   += ShapeInstance_MouseLeftButtonUp;
            shape.Instance.MouseMove           += ShapeInstance_MouseMove;

            Stage.Children.Add(shape.Instance);
        }