方法一:旋转画图区,以90度旋转为例    

 private void btnRotate90_Click(object sender, EventArgs e)
        {
            Graphics gs = pictureBox1.CreateGraphics();
            string strFile = @"E:\p.jpg";
            Bitmap bmp = new Bitmap(strFile);
            gs.FillRectangle(Brushes.White, pictureBox1.ClientRectangle);
            Point[] destinationPoints = { new Point(ClientRectangle.Width, 0), new Point(ClientRectangle.Width, ClientRectangle.Height), new Point(0, 0) };
            gs.DrawImage(bmp, destinationPoints);
        }

方法二:旋转图像自身,以90度旋转为例      

 private void btnRotate90_Click(object sender, EventArgs e)
        {
            Graphics gs = pictureBox1.CreateGraphics();
            string strFile = @"E:\p.jpg";
            Image img = Image.FromFile(strFile);
            img.RotateFlip(RotateFlipType.Rotate90FlipNone);
            gs.DrawImage(img, pictureBox1.ClientRectangle);

        }

posted on 2011-06-09 16:10  简单-生活  阅读(3104)  评论(0编辑  收藏  举报