Image.RotateFlip(RotateFlipType) Yöntem

Tanım

döndürür, çevirir veya döndürür ve çevirir Image.

public:
 void RotateFlip(System::Drawing::RotateFlipType rotateFlipType);
public void RotateFlip (System.Drawing.RotateFlipType rotateFlipType);
member this.RotateFlip : System.Drawing.RotateFlipType -> unit
Public Sub RotateFlip (rotateFlipType As RotateFlipType)

Parametreler

rotateFlipType
RotateFlipType

RotateFlipType Görüntüye uygulanacak döndürme ve çevirme türünü belirten bir üye.

Örnekler

Aşağıdaki kod örneği, ve Image sabit listesi üzerinde yönteminin RotateFlip nasıl çağrılduğunu RotateFlipType gösterir.

Bu örnek, adlı ve adlı PictureBox1Button1bir düğme içeren bir PictureBox Windows Formu ile kullanılacak şekilde tasarlanmıştır. Kodu bir forma yapıştırın, formun oluşturucusundan çağırın InitializeBitmap ve düğmenin Click olayıyla ilişkilendirinButton1_Click. Bit eşlem dosyasının yolunun sisteminizde geçerli olduğundan emin olun.

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

Açıklamalar

RotateFlip yöntemi görüntüyü saat yönünde döndürür.

Bir resim döndürüldükten sonra üzerine çizim yapmak isterseniz, görüntüden her zaman yeni bir grafik nesnesi almanız gerekir, aksi takdirde bir özel durum oluşabilir.

Şunlara uygulanır