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.
 
Back
Top