1
導致的大小我有在C#中旋轉的圖像下面的代碼:獲取RotateTransform
private Bitmap RotateImage(Bitmap b, float angle)
{
//create a new empty bitmap to hold rotated image
Bitmap returnBitmap = new Bitmap(b.Width, b.Height);
//make a graphics object from the empty bitmap
Graphics g = Graphics.FromImage(returnBitmap);
//move rotation point to center of image
g.TranslateTransform((float)returnBitmap.Width/2, (float)returnBitmap.Height/2);
//rotate
g.RotateTransform(angle);
//move image back
g.TranslateTransform(-(float)b.Width/2, -(float)b.Height/2);
//draw passed in image onto graphics object
g.DrawImage(b, new Rectangle(new Point(0, 0), new Size(b.Width, b.Height)));
return returnBitmap;
}
它時,它超過了原來的界限的作品非常好,但它的剪輯的結果。
據我所知,我必須將rotateBitmap的大小設置爲旋轉後的圖像大小。但是,我如何找到結果會有多大,以相應地設置新位圖的大小?
看一看我的意見[這裏](https://stackoverflow.com/questions/5172906/C-旋轉圖形/ 48725273#48725273) –