public override void MoveToCore(Point newLocation) { base.MoveToCore(newLocation); if (Figure != null) { if (Figure is PBRect) { PBRect rect = Figure as PBRect; rect.Width = Math.Abs(rect.Coordinates.X - Coordinates.X) * 2; rect.Height = Math.Abs(rect.Coordinates.Y - Coordinates.Y) * 2; rect.UpdateVisual(); } if (Figure is PBCircle) { PBCircle circle = Figure as PBCircle; circle.Radius = Math.Distance(circle.Coordinates.X, circle.Coordinates.Y, Coordinates.X, Coordinates.Y); circle.UpdateVisual(); } } }
public static PBRect CreateRectShape(Drawing drawing, System.Windows.Point coordinates) { PBRect rect = new PBRect() { Drawing = drawing }; rect.MoveTo(coordinates); rect.Height = 1; rect.Width = 1; if (Behavior.DrawVideo) { rect.Shape.Stroke = new SolidColorBrush(Color); rect.Shape.Fill = Brushes.Transparent; rect.Shape.StrokeThickness = 2; } return(rect); }