c# pictureBox放转显示

Image image = Image.FromFile(@"c:/fp.bmp");
Bitmap bmp = new Bitmap(image);
image.Dispose(); //释放文件占用,这句话很重要
pictureBox1.Image = Rotate(bmp, RotateFlipType.Rotate180FlipNone);

 

 

 

//旋转
private Bitmap Rotate(Bitmap source, RotateFlipType rotateFlipType)
{
Rectangle rect = new Rectangle(0, 0, source.Width, source.Height);
Bitmap target = source.Clone(rect, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
target.RotateFlip(rotateFlipType);
return target;
}

posted @ 2011-12-11 17:09  meetrice  阅读(266)  评论(0编辑  收藏  举报