Edit

Share via


RotateFlipType Enum

Definition

Specifies how much an image is rotated and the axis used to flip the image.

C#
public enum RotateFlipType
Inheritance
RotateFlipType

Fields

Name Value Description
Rotate180FlipXY 0

Specifies a 180-degree clockwise rotation followed by a horizontal and vertical flip.

RotateNoneFlipNone 0

Specifies no clockwise rotation and no flipping.

Rotate270FlipXY 1

Specifies a 270-degree clockwise rotation followed by a horizontal and vertical flip.

Rotate90FlipNone 1

Specifies a 90-degree clockwise rotation without flipping.

Rotate180FlipNone 2

Specifies a 180-degree clockwise rotation without flipping.

RotateNoneFlipXY 2

Specifies no clockwise rotation followed by a horizontal and vertical flip.

Rotate270FlipNone 3

Specifies a 270-degree clockwise rotation without flipping.

Rotate90FlipXY 3

Specifies a 90-degree clockwise rotation followed by a horizontal and vertical flip.

Rotate180FlipY 4

Specifies a 180-degree clockwise rotation followed by a vertical flip.

RotateNoneFlipX 4

Specifies no clockwise rotation followed by a horizontal flip.

Rotate270FlipY 5

Specifies a 270-degree clockwise rotation followed by a vertical flip.

Rotate90FlipX 5

Specifies a 90-degree clockwise rotation followed by a horizontal flip.

Rotate180FlipX 6

Specifies a 180-degree clockwise rotation followed by a horizontal flip.

RotateNoneFlipY 6

Specifies no clockwise rotation followed by a vertical flip.

Rotate270FlipX 7

Specifies a 270-degree clockwise rotation followed by a horizontal flip.

Rotate90FlipY 7

Specifies a 90-degree clockwise rotation followed by a vertical flip.

Examples

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.

C#
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;
    }
}

Remarks

The image is rotated in a clockwise direction.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9