RotateFlipType 枚举

指定图像的旋转方向和用于翻转图像的轴。

**命名空间:**System.Drawing
**程序集:**System.Drawing(在 system.drawing.dll 中)

语法

声明
Public Enumeration RotateFlipType
用法
Dim instance As RotateFlipType
public enum RotateFlipType
public enum class RotateFlipType
public enum RotateFlipType
public enum RotateFlipType

成员

  成员名称 说明
Rotate180FlipNone 指定不进行翻转的 180 度旋转。 
Rotate180FlipX 指定后接水平翻转的 180 度旋转。 
Rotate180FlipXY 指定后接水平翻转和垂直翻转的 180 度旋转。 
Rotate180FlipY 指定后接垂直翻转的 180 度旋转。 
Rotate270FlipNone 指定不进行翻转的 270 度旋转。 
Rotate270FlipX 指定后接水平翻转的 270 度旋转。 
Rotate270FlipXY 指定后接水平翻转和垂直翻转的 270 度旋转。 
Rotate270FlipY 指定后接垂直翻转的 270 度旋转。 
Rotate90FlipNone 指定不进行翻转的 90 度旋转。 
Rotate90FlipX 指定后接水平翻转的 90 度旋转。 
Rotate90FlipXY 指定后接水平翻转和垂直翻转的 90 度旋转。 
Rotate90FlipY 指定后接垂直翻转的 90 度旋转。 
RotateNoneFlipNone 指定不进行旋转和翻转。 
RotateNoneFlipX 指定没有后跟水平翻转的旋转。 
RotateNoneFlipXY 指定没有后跟水平和垂直翻转的旋转。 
RotateNoneFlipY 指定没有后跟垂直翻转的旋转。 

示例

下面的代码示例演示如何设置 ImageRotateFlip 属性和 RotateFlipType 枚举。

此示例旨在用于包含名为 PictureBox1PictureBox 和名为 Button1 的按钮的 Windows 窗体。将该代码粘贴到一个窗体中,在该窗体的构造函数或 Load 事件处理方法中调用 InitializeBitmap,并将 Button1_Click 与按钮的 Click 事件关联。请确保位图的文件路径在您的系统上是有效的。

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 Not bitmap1 Is Nothing Then
        bitmap1.RotateFlip(RotateFlipType.Rotate180FlipY)
        PictureBox1.Image = bitmap1
    End If

End Sub
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;
    }

}
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;
   }
}
private Bitmap bitmap1;

private void InitializeBitmap()
{
    try {
        bitmap1 = ((Bitmap)(Bitmap.FromFile(("C:\\Documents and Settings\\"
            + "All Users\\Documents\\My Music\\music.bmp"))));
        pictureBox1.set_SizeMode(PictureBoxSizeMode.AutoSize);
        pictureBox1.set_Image(bitmap1);
    }
    catch (System.IO.FileNotFoundException exp) {
        MessageBox.Show(("There was an error." 
            + "Check the path to the bitmap."));
    }
} //InitializeBitmap

private void button1_Click(Object sender, System.EventArgs e)
{
    if (bitmap1 != null) {
        bitmap1.RotateFlip(RotateFlipType.Rotate180FlipY);
        pictureBox1.set_Image(bitmap1);
    }
} //button1_Click

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

System.Drawing 命名空间