Share via

Unexpected margin around rotated shape

Will Pittenger 311 Reputation points
2021-04-12T07:25:39.51+00:00

I have some SVG files that I have SharpVectors turning into System.Windows.Media.DrawingGroup instances. I then need to spin those shapes around to various angles determined at runtime. From what I can tell, putting a System.Windows.Media.RotateTransform on either the System.Windows.Media.GeometryDrawing instance or the System.Windows.Controls.Image instance, Windows is acting like I'm spinning a bitmap around rather than a vector drawing. Once rotated, the shape shouldn't be much larger. In fact, one dimension might shrink.

What I'm actually seeing is the imaginary "corners" adding to the space. Take a look at the following images.

86689-image.png ---- 86710-image.png

The two rectangles in the left image are the same size. But when I rotate them, the size seems to grow. The right image is closer to what my code is trying to do. Notice this time, there isn't as much change in the width or height.

Developer technologies | Windows Presentation Foundation

1 answer

Sort by: Most helpful
  1. Will Pittenger 311 Reputation points
    2021-04-18T22:59:58.107+00:00

    @DaisyTian-MSFT As you can see from the attached image, things aren't where they should be. The crosses represent points where events will happen. In this case, two aren't yet used. But the others should have a ship centered over the crosses. These ships are similar to the one I showed you, but with different details. They're loaded the same way.

    88843-image.png

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.