/// <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 = "请选择要复制的图形!"; } }