Rotating Graphics

  • Thread starter Thread starter Paul E Collins
  • Start date Start date
P

Paul E Collins

I can draw on a PictureBox like this ...

private void pic_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
using (SolidBrush brush = new SolidBrush(Color.Red))
{
g.FillRectangle(brush, 0, 0, 100, 100);
}
}

.... but how can I rotate the resulting graphical output?

pic.Image.RotateFlip is no good, because my drawing doesn't count as an
Image property. I've also tried g.RotateTransform, but that doesn't seem to
do anything.

P.
 
Paul,

1. Ensure you apply RotateTransform before drawing the rectangle.
2. Ensure the FillRectangle method supports the transformations. You might
need an alternative method of drawing your image.
 

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

Back
Top