RotateFlipType Enumeration

Specifies the direction of an image's rotation and the axis used to flip the image.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

'Declaration
Public Enumeration RotateFlipType
'Usage
Dim instance As RotateFlipType

public enum RotateFlipType
public enum RotateFlipType

 Member nameDescription
Rotate180FlipNoneSpecifies a 180-degree rotation without flipping. 
Rotate180FlipXSpecifies a 180-degree rotation followed by a horizontal flip. 
Rotate180FlipXYSpecifies a 180-degree rotation followed by a horizontal and vertical flip. 
Rotate180FlipYSpecifies a 180-degree rotation followed by a vertical flip. 
Rotate270FlipNoneSpecifies a 270-degree rotation without flipping. 
Rotate270FlipXSpecifies a 270-degree rotation followed by a horizontal flip. 
Rotate270FlipXYSpecifies a 270-degree rotation followed by a horizontal and vertical flip. 
Rotate270FlipYSpecifies a 270-degree rotation followed by a vertical flip. 
Rotate90FlipNoneSpecifies a 90-degree rotation without flipping. 
Rotate90FlipXSpecifies a 90-degree rotation followed by a horizontal flip. 
Rotate90FlipXYSpecifies a 90-degree rotation followed by a horizontal and vertical flip. 
Rotate90FlipYSpecifies a 90-degree rotation followed by a vertical flip. 
RotateNoneFlipNoneSpecifies no rotation and no flipping. 
RotateNoneFlipXSpecifies no rotation followed by a horizontal flip. 
RotateNoneFlipXYSpecifies no rotation followed by a horizontal and vertical flip. 
RotateNoneFlipYSpecifies no rotation followed by a vertical flip. 

The following code example demonstrates how to set the RotateFlip property of an Image and the RotateFlipType enumeration.

This example is designed to be used with a Windows Form that contains a PictureBox named PictureBox1 and a button named Button1. 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.

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

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 Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: