Rotating a Graphic

N

Nathan Sokalski

I have a Graphics object that I have drawn several things on using transform
methods (such as RotateTransform and TranslateTransform) and drawing methods
(such as FillRectangle and DrawString) of the Graphics object. It now looks
exactly how I want, except for one thing. I want to rotate the entire thing
by 180 degrees. How can I do this? I think there is something with the
SetClip method or something, but since I don't have a ton of experience with
the Graphics class, I may need some help. Thanks.
 
M

Morten Wennevik [C# MVP]

Nathan Sokalski said:
I have a Graphics object that I have drawn several things on using transform
methods (such as RotateTransform and TranslateTransform) and drawing methods
(such as FillRectangle and DrawString) of the Graphics object. It now looks
exactly how I want, except for one thing. I want to rotate the entire thing
by 180 degrees. How can I do this? I think there is something with the
SetClip method or something, but since I don't have a ton of experience with
the Graphics class, I may need some help. Thanks.

Hi Nathan,

You can add a Rotate and Translate at the top of the graphics manipulation

e.Graphics.RotateTransform(180);
e.Graphics.TranslateTransform(ClientRectangle.Width, ClientRectangle.Height,
MatrixOrder.Append);

Any drawing from here on will be upside down
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top