十四. 以不同翻轉方式顯示圖像.
原理: Bitmap 類的 RotateFip()方法
代碼:
以不同翻轉方式顯示圖像
Code
[copy to clipboard]
CODE:
private void button1_Click(object sender, EventArgs e)
{
//以不同翻轉方式顯示圖像
Graphics g = this.panel1.CreateGraphics();
for (int i = 0; i < 17; i++)
{
switch (i)
{
case 0:
MyBitmap.RotateFlip(RotateFlipType.RotateNoneFlipX);
break;
case 1:
MyBitmap.RotateFlip(RotateFlipType.Rotate180FlipNone);
break;
case 2:
MyBitmap.RotateFlip(RotateFlipType.Rotate180FlipX);
break;
case 3:
MyBitmap.RotateFlip(RotateFlipType.Rotate180FlipXY);
break;
case 4:
MyBitmap.RotateFlip(RotateFlipType.Rotate180FlipY);
break;
case 5:
MyBitmap.RotateFlip(RotateFlipType.Rotate270FlipNone);
break;
case 6:
MyBitmap.RotateFlip(RotateFlipType.Rotate270FlipX);
break;
case 7:
MyBitmap.RotateFlip(RotateFlipType.Rotate270FlipXY);
break;
case 8:
MyBitmap.RotateFlip(RotateFlipType.Rotate270FlipY);
break;
case 9:
MyBitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
break;
case 10:
MyBitmap.RotateFlip(RotateFlipType.Rotate90FlipX);
break;
case 11:
MyBitmap.RotateFlip(RotateFlipType.Rotate90FlipXY);
break;
case 12:
MyBitmap.RotateFlip(RotateFlipType.Rotate90FlipY);
break;
case 13:
MyBitmap.RotateFlip(RotateFlipType.RotateNoneFlipNone);
break;
case 14:
MyBitmap.RotateFlip(RotateFlipType.RotateNoneFlipX);
break;
case 15:
MyBitmap.RotateFlip(RotateFlipType.RotateNoneFlipXY);
break;
case 16:
MyBitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
break;
}
g.Clear(Color.White);
g.DrawImage(MyBitmap, 0, 0);
System.Threading.Thread.Sleep(1000);
}
}
十五. ...............
太多了, 大多都是一些GDI+類的常用方法, 如果感興趣的可以把幾個常用類熟悉一下.
自己也能實現很多個性化的以動畫方式顯示圖像.