/// <summary> /// 旋转图片 /// </summary> /// <param name="vRotate">旋转角度</param> public void RotateImage(double vRotate) { if (isBitmap) { // Create a temporary rescaled bitmap using (FreeImageBitmap temp = bitmap.GetScaledInstance(resultbmp.Width, resultbmp.Height, FREE_IMAGE_FILTER.FILTER_CATMULLROM)) { if (temp != null) { // Rotate the bitmap temp.Rotate(vRotate); if (resultbmp != null) { resultbmp.Dispose(); } // Display the result resultbmp = (Bitmap)temp; } } } }
private void bRotate_Click(object sender, EventArgs e) { if (Bitmap) { // Create a temporary rescaled bitmap using (FreeImageBitmap temp = bitmap.GetScaledInstance( pictureBox.DisplayRectangle.Width, pictureBox.DisplayRectangle.Height, FREE_IMAGE_FILTER.FILTER_CATMULLROM)) { if (temp != null) { // Rotate the bitmap temp.Rotate((double)vRotate.Value); if (pictureBox.Image != null) { pictureBox.Image.Dispose(); } // Display the result pictureBox.Image = (Bitmap)temp; } } } }