Reputation: 609
I'm new to C# and .net, just trying to work out how to do something that I thought would be relatively simple. I'm creating a bitmap to be later saved as an image to disk, part of it I want to draw a rectangle shape. I can do this, however I'm looking for a simple way to do this on an angle. I need to be able to specify an angle to draw the rectangle at, I also need to be able to to specify the rotation point (I need to rotate around the top left hand point of the rectangle).
How is this usually achieved with c#/.net, is there something built in for this sort of thing that I haven't found ?
Upvotes: 4
Views: 18535
Reputation: 134105
The Graphics class supports setting transforms that will let you scale, shear, rotate, etc. See Coordinate Systems and Transformations.
You can find an example at Using a matrix to rotate rectangles individually.
Upvotes: 10