RotateFlipType 列舉

定義

指定影像的旋轉量以及用來翻轉影像的座標軸。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
繼承
RotateFlipType

欄位

Rotate180FlipNone 2

指定不翻轉的 180 度順時針旋轉。Specifies a 180-degree clockwise rotation without flipping.

Rotate180FlipX 6

指定 180 度順時針旋轉,後面接續水平翻轉。Specifies a 180-degree clockwise rotation followed by a horizontal flip.

Rotate180FlipXY 0

指定 180 度順時針旋轉,後面接續水平和垂直翻轉。Specifies a 180-degree clockwise rotation followed by a horizontal and vertical flip.

Rotate180FlipY 4

指定 180 度順時針旋轉,後面接續垂直翻轉。Specifies a 180-degree clockwise rotation followed by a vertical flip.

Rotate270FlipNone 3

指定不翻轉的 270 度順時針旋轉。Specifies a 270-degree clockwise rotation without flipping.

Rotate270FlipX 7

指定 270 度順時針旋轉,後面接續水平翻轉。Specifies a 270-degree clockwise rotation followed by a horizontal flip.

Rotate270FlipXY 1

指定 270 度順時針旋轉,後面接續水平和垂直翻轉。Specifies a 270-degree clockwise rotation followed by a horizontal and vertical flip.

Rotate270FlipY 5

指定 270 度順時針旋轉,後面接續垂直翻轉。Specifies a 270-degree clockwise rotation followed by a vertical flip.

Rotate90FlipNone 1

指定不翻轉的 90 度順時針旋轉。Specifies a 90-degree clockwise rotation without flipping.

Rotate90FlipX 5

指定 90 度順時針旋轉,後面接續水平翻轉。Specifies a 90-degree clockwise rotation followed by a horizontal flip.

Rotate90FlipXY 3

指定 90 度順時針旋轉,後面接續水平和垂直翻轉。Specifies a 90-degree clockwise rotation followed by a horizontal and vertical flip.

Rotate90FlipY 7

指定 90 度順時針旋轉,後面接續垂直翻轉。Specifies a 90-degree clockwise rotation followed by a vertical flip.

RotateNoneFlipNone 0

指定不順時針旋轉也不翻轉。Specifies no clockwise rotation and no flipping.

RotateNoneFlipX 4

指定不順時針旋轉,後面接續水平翻轉。Specifies no clockwise rotation followed by a horizontal flip.

RotateNoneFlipXY 2

指定不順時針旋轉,後面接續水平和垂直翻轉。Specifies no clockwise rotation followed by a horizontal and vertical flip.

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 Form 使用, 其中包含名為PictureBox PictureBox1的和名Button1為的按鈕。This 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.

適用於