Image Rotation
-
I have the following code to rotate an image: Image img=new Bitmap(400,400); //assigned to pictureBox 4 pictureBox4.Image=img; Graphics g=Graphics.FromImage(pictureBox4.Image); //Create a new matrix Matrix mm=new Matrix(); mm=new Matrix(1,0,0,-1,0,0); mm.Translate(25,104,MatrixOrder.Append); g.Transform=mm; Matrix mm1=new Matrix(); mm1.RotateAt( trackBar1.Value, new Point(67,2), MatrixOrder.Append); GraphicsPath gp=new GraphicsPath(); Image imgpic=(Image)Rotor_pictureBox.Image; gp.AddPolygon(new Point[]{new Point(0,Rotor_pictureBox.Height),new Point(Rotor_pictureBox.Width,Rotor_pictureBox.Height),new Point(0,0)}); gp.Transform(mm1); //get the resulting path points PointF[] pts=gp.PathPoints; //draw on the picturebox content of imgpic using the local transformation //using the resulting parralleogram described by pts g.DrawImage(imgpic,pts); pictureBox4.Refresh(); This code works great. However, I can't get the image to BrintToFront. I need it to rest on top of another picturebox. If there is another picture box within the rotating image's area, it covers it up. I tried to put an image WITHIN the picturebox that the rotating image is being drawn on, but it doesn't show up. Any help would be much appreciated. Thanks. D -- modified at 7:41 Wednesday 5th October, 2005