RotateFlip Method

Image.RotateFlip Method

Rotates, flips, or rotates and flips the Image.

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

public void RotateFlip(
	RotateFlipType rotateFlipType


Type: System.Drawing.RotateFlipType
A RotateFlipType member that specifies the type of rotation and flip to apply to the image.

The RotateFlip method rotates the image clockwise.

If you wish to draw on an image once it has been rotated, you should always retrieve a new graphics object from the image, otherwise an exception could occur.

The following code example demonstrates how to call the RotateFlip method on 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, and associate Button1_Click with the button's Click event. Ensure the file path to the bitmap is valid on your system.

Bitmap bitmap1;

private void InitializeBitmap()
        bitmap1 = (Bitmap)Bitmap.FromFile(@"C:\Documents and Settings\" + 
            @"All Users\Documents\My Music\music.bmp");
        PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
        PictureBox1.Image = bitmap1;
        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)
        PictureBox1.Image = bitmap1;


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2016 Microsoft