RotateFlipType 枚举  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定图像的旋转程度和用于翻转图像的轴。
public enum class RotateFlipTypepublic enum RotateFlipTypetype RotateFlipType = Public Enum RotateFlipType- 继承
字段
| 名称 | 值 | 说明 | 
|---|---|---|
| Rotate180FlipNone | 2 | 指定不进行翻转的 180 度顺时针旋转。 | 
| Rotate180FlipX | 6 | 指定后接水平翻转的 180 度顺时针旋转。 | 
| Rotate180FlipXY | 0 | 指定后接水平翻转和垂直翻转的 180 度顺时针旋转。 | 
| Rotate180FlipY | 4 | 指定后接垂直翻转的 180 度顺时针旋转。 | 
| Rotate270FlipNone | 3 | 指定不进行翻转的 270 度顺时针旋转。 | 
| Rotate270FlipX | 7 | 指定后接水平翻转的 270 度顺时针旋转。 | 
| Rotate270FlipXY | 1 | 指定后接水平翻转和垂直翻转的 270 度顺时针旋转。 | 
| Rotate270FlipY | 5 | 指定后接垂直翻转的 270 度顺时针旋转。 | 
| Rotate90FlipNone | 1 | 指定不进行翻转的 90 度顺时针旋转。 | 
| Rotate90FlipX | 5 | 指定后接水平翻转的 90 度顺时针旋转。 | 
| Rotate90FlipXY | 3 | 指定后接水平翻转和垂直翻转的 90 度顺时针旋转。 | 
| Rotate90FlipY | 7 | 指定后接垂直翻转的 90 度顺时针旋转。 | 
| RotateNoneFlipNone | 0 | 指定不进行顺时针旋转和翻转。 | 
| RotateNoneFlipX | 4 | 指定没有后接水平翻转的顺时针旋转。 | 
| RotateNoneFlipXY | 2 | 指定没有后接水平翻转和垂直翻转的顺时针旋转。 | 
| RotateNoneFlipY | 6 | 指定没有后接垂直翻转的顺时针旋转。 | 
示例
下面的代码示例演示如何设置 RotateFlip 和 枚举的 ImageRotateFlipType 属性。
此示例旨在与包含 PictureBox 名为 PictureBox1 的和名为 的按钮的 Button1Windows 窗体一起使用。 将代码粘贴到窗体中,从窗体的构造函数或事件处理方法调用 InitializeBitmap 并与按钮的事件Click相关联Button1_Click。Load 确保位图的文件路径在系统上有效。
Bitmap^ bitmap1;
void InitializeBitmap()
{
   try
   {
      bitmap1 = dynamic_cast<Bitmap^>(Bitmap::FromFile( "C:\\Documents and Settings\\"
      "All Users\\Documents\\My Music\\music.bmp" ));
      PictureBox1->SizeMode = PictureBoxSizeMode::AutoSize;
      PictureBox1->Image = bitmap1;
   }
   catch ( System::IO::FileNotFoundException^ ) 
   {
      MessageBox::Show( "There was an error."
      "Check the path to the bitmap." );
   }
}
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   if ( bitmap1 != nullptr )
   {
      bitmap1->RotateFlip( RotateFlipType::Rotate180FlipY );
      PictureBox1->Image = bitmap1;
   }
}
Bitmap bitmap1;
private void InitializeBitmap()
{
    try
    {
        bitmap1 = (Bitmap)Bitmap.FromFile(@"C:\Documents and Settings\" + 
            @"All Users\Documents\My Music\music.bmp");
        PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
        PictureBox1.Image = bitmap1;
    }
    catch(System.IO.FileNotFoundException)
    {
        MessageBox.Show("There was an error." + 
            "Check the path to the bitmap.");
    }
}
private void Button1_Click(System.Object sender, System.EventArgs e)
{
    if (bitmap1 != null)
    {
        bitmap1.RotateFlip(RotateFlipType.Rotate180FlipY);
        PictureBox1.Image = bitmap1;
    }
}
Dim bitmap1 As Bitmap
Private Sub InitializeBitmap()
    Try
        bitmap1 = CType(Bitmap.FromFile("C:\Documents and Settings\All Users\" _
            & "Documents\My Music\music.bmp"), Bitmap)
        PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
        PictureBox1.Image = bitmap1
    Catch ex As System.IO.FileNotFoundException
        MessageBox.Show("There was an error. Check the path to the bitmap.")
    End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    If bitmap1 IsNot Nothing Then
        bitmap1.RotateFlip(RotateFlipType.Rotate180FlipY)
        PictureBox1.Image = bitmap1
    End If
End Sub
注解
图像按顺时针方向旋转。