private void resizeHeight(double deltaX, double deltaY, Orientation orientation) { Debug.Assert(orientation == Orientation.Top || orientation == Orientation.Bottom); float rotation = m_RotationAngle; while (rotation < 0) { rotation += 360; } double rotationRadian = PocketPaintApplication.DegreeToRadian(rotation); //double deltaXCorrected = Math.Cos(-rotationRadian) * (deltaX) // - Math.Sin(-rotationRadian) * (deltaY); double deltaYCorrected = Math.Sin(-rotationRadian) * (deltaX) + Math.Cos(-rotationRadian) * (deltaY); if (orientation == Orientation.Top) { deltaYCorrected = deltaYCorrected * -1; } double newHeightRectangleToDraw = AreaToDrawGrid.Height + deltaYCorrected; if (newHeightRectangleToDraw < m_MinHeightRectangleToDraw) { newHeightRectangleToDraw = m_MinHeightRectangleToDraw; deltaYCorrected = m_MinHeightRectangleToDraw - AreaToDrawGrid.Height; } // TODO: maximum height? SetHeightOfControl(newHeightRectangleToDraw); double deltaYTop = 0; double deltaYBottom = 0; if (orientation == Orientation.Top) { deltaYTop = deltaYCorrected; } else if (orientation == Orientation.Bottom) { deltaYBottom = deltaYCorrected; } ChangeMarginOfGridMainSelection(GridMainSelection.Margin.Left, GridMainSelection.Margin.Top - deltaYTop, GridMainSelection.Margin.Right, GridMainSelection.Margin.Bottom - deltaYBottom); //var transform = rectRectangleToDraw.TransformToVisual(GridMainSelection); //Point absolutePosition = transform.TransformPoint(new Point(0, 0)); //absolutePosition.X += rectRectangleToDraw.Width / 2; //absolutePosition.Y += rectRectangleToDraw.Height / 2; //RotateTransform rt; //rt = new RotateTransform { Angle = m_rotation, CenterX = absolutePosition.X, CenterY = absolutePosition.Y }; //addTransformation(rt); PocketPaintApplication.GetInstance().BarRecEllShape.setBtnHeightValue = newHeightRectangleToDraw; }