RotateFlipType 列舉

定義

指定影像的旋轉量以及用來翻轉影像的座標軸。

public enum class RotateFlipType
public enum RotateFlipType
type RotateFlipType = 
Public Enum RotateFlipType
繼承
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

指定不順時針旋轉,後面接續垂直翻轉。

範例

下列程式碼範例示範如何設定 RotateFlipRotateFlipType 列舉的 Image 屬性。

此範例的設計目的是要與 Windows Form 搭配使用,其中包含 PictureBox 具名 PictureBox1 的 和名為 的 Button1 按鈕。 將程式碼貼到表單中、從表單的建構函式或 Load 事件處理方法呼叫 InitializeBitmap ,並與按鈕的事件 Click 產生關聯 Button1_Click 。 確定點陣圖的檔案路徑在您的系統上有效。

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

備註

影像會以順時針方向旋轉。

適用於