RotateFlipType RotateFlipType RotateFlipType RotateFlipType Enum

定义

指定图像的旋转程度和用于翻转图像的轴。Specifies how much an image is rotated and the axis used to flip the image.

public enum class RotateFlipType
public enum RotateFlipType
type RotateFlipType = 
Public Enum RotateFlipType
继承
RotateFlipTypeRotateFlipTypeRotateFlipTypeRotateFlipType

字段

Rotate180FlipNone Rotate180FlipNone Rotate180FlipNone Rotate180FlipNone 2

指定不进行翻转的 180 度顺时针旋转。Specifies a 180-degree clockwise rotation without flipping.

Rotate180FlipX Rotate180FlipX Rotate180FlipX Rotate180FlipX 6

指定后接水平翻转的 180 度顺时针旋转。Specifies a 180-degree clockwise rotation followed by a horizontal flip.

Rotate180FlipXY Rotate180FlipXY Rotate180FlipXY Rotate180FlipXY 0

指定后接水平翻转和垂直翻转的 180 度顺时针旋转。Specifies a 180-degree clockwise rotation followed by a horizontal and vertical flip.

Rotate180FlipY Rotate180FlipY Rotate180FlipY Rotate180FlipY 4

指定后接垂直翻转的 180 度顺时针旋转。Specifies a 180-degree clockwise rotation followed by a vertical flip.

Rotate270FlipNone Rotate270FlipNone Rotate270FlipNone Rotate270FlipNone 3

指定不进行翻转的 270 度顺时针旋转。Specifies a 270-degree clockwise rotation without flipping.

Rotate270FlipX Rotate270FlipX Rotate270FlipX Rotate270FlipX 7

指定后接水平翻转的 270 度顺时针旋转。Specifies a 270-degree clockwise rotation followed by a horizontal flip.

Rotate270FlipXY Rotate270FlipXY Rotate270FlipXY Rotate270FlipXY 1

指定后接水平翻转和垂直翻转的 270 度顺时针旋转。Specifies a 270-degree clockwise rotation followed by a horizontal and vertical flip.

Rotate270FlipY Rotate270FlipY Rotate270FlipY Rotate270FlipY 5

指定后接垂直翻转的 270 度顺时针旋转。Specifies a 270-degree clockwise rotation followed by a vertical flip.

Rotate90FlipNone Rotate90FlipNone Rotate90FlipNone Rotate90FlipNone 1

指定不进行翻转的 90 度顺时针旋转。Specifies a 90-degree clockwise rotation without flipping.

Rotate90FlipX Rotate90FlipX Rotate90FlipX Rotate90FlipX 5

指定后接水平翻转的 90 度顺时针旋转。Specifies a 90-degree clockwise rotation followed by a horizontal flip.

Rotate90FlipXY Rotate90FlipXY Rotate90FlipXY Rotate90FlipXY 3

指定后接水平翻转和垂直翻转的 90 度顺时针旋转。Specifies a 90-degree clockwise rotation followed by a horizontal and vertical flip.

Rotate90FlipY Rotate90FlipY Rotate90FlipY Rotate90FlipY 7

指定后接垂直翻转的 90 度顺时针旋转。Specifies a 90-degree clockwise rotation followed by a vertical flip.

RotateNoneFlipNone RotateNoneFlipNone RotateNoneFlipNone RotateNoneFlipNone 0

指定不进行顺时针旋转和翻转。Specifies no clockwise rotation and no flipping.

RotateNoneFlipX RotateNoneFlipX RotateNoneFlipX RotateNoneFlipX 4

指定没有后接水平翻转的顺时针旋转。Specifies no clockwise rotation followed by a horizontal flip.

RotateNoneFlipXY RotateNoneFlipXY RotateNoneFlipXY RotateNoneFlipXY 2

指定没有后接水平翻转和垂直翻转的顺时针旋转。Specifies no clockwise rotation followed by a horizontal and vertical flip.

RotateNoneFlipY RotateNoneFlipY RotateNoneFlipY RotateNoneFlipY 6

指定没有后接垂直翻转的顺时针旋转。Specifies no clockwise rotation followed by a vertical flip.

示例

下面的代码示例演示如何设置RotateFlip的属性ImageRotateFlipType枚举。The following code example demonstrates how to set the RotateFlip property of an Image and the RotateFlipType enumeration.

此示例设计用于包含的 Windows 窗体PictureBox名为PictureBox1和名为的按钮Button1This example is designed to be used with a Windows Form that contains a PictureBox named PictureBox1 and a button named Button1. 将代码粘贴到窗体,调用InitializeBitmap从窗体的构造函数或Load事件处理方法,并关联Button1_Click与该按钮的Click事件。Paste the code into a form, call InitializeBitmap from the form's constructor or Load event-handling method and associate Button1_Click with the button's Click event. 请确保位图的文件路径是在您的系统上有效。Ensure the file path to the bitmap is valid on your system.

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

注解

要将图像顺时针方向旋转。The image is rotated in a clockwise direction.

适用于