public void SetNewGeometry() { Geometry = new GeometryGroup(); Geometry.Children.Add(ShapeComponent.GetGeometry(0, 0, ShapeComponent.Width, ShapeComponent.Height)); Geometry.Children.Add(GetGeometry()); }
public void Execute(ShapeComponent shapeComponent) { Rect bounds = shapeComponent.GetGeometry().GetRenderBounds(new Pen(), 0, ToleranceType.Absolute); double newwidth = 0; double newheight = 0; switch (MousePositionType) { case MousePositionType.UL: newwidth = bounds.Width * DiffenceWidth; newheight = bounds.Height * DiffenceHeight; break; case MousePositionType.UR: newwidth = bounds.Width * DiffenceWidth; newheight = bounds.Height * DiffenceHeight; break; case MousePositionType.DR: newwidth = bounds.Width * DiffenceWidth; newheight = bounds.Height * DiffenceHeight; break; case MousePositionType.DL: newwidth = bounds.Width * DiffenceWidth; newheight = bounds.Height * DiffenceHeight; break; case MousePositionType.L: newwidth = bounds.Width * DiffenceWidth; break; case MousePositionType.R: newwidth = bounds.Width * DiffenceWidth; break; case MousePositionType.B: newheight = bounds.Height * DiffenceHeight; break; case MousePositionType.T: newheight = bounds.Height * DiffenceHeight; break; } if (newheight > 0) { shapeComponent.Height = newheight; } if (newwidth > 0) { shapeComponent.Width = newwidth; } //if (DiffenceHeight >= 0) //{ // shapeComponent.Height = shapeComponent.ActualHeight * DiffenceHeight; //} //if (DiffenceWidth >= 0) //{ // shapeComponent.Width = shapeComponent.ActualWidth * DiffenceWidth; //} }