2009-02-13 59 views

回答

7

我會假設你想旋轉裏面的圖像,因爲旋轉盒子本身沒有多大意義(並且不可能)。

試試這個:

myPictureBox.Image.RotateFlip(RotateFlipType.Rotate180FlipNone); 
2

的System.Drawing.Image.RotateFlip給出可以用來VB.net ()方法允許您旋轉顯示在圖框中的實際圖像。見this page

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 
+0

此代碼很有幫助 - 謝謝! – user39035 2009-02-15 04:27:45

1
PictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone) 
PictureBox1.Refresh() 

當您嘗試使用圖像旋轉:

PictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone) 

什麼都不會發生,直到您關閉該窗體,然後再次打開它(而不是項目,只是形式)。如果你想一次旋轉,那麼你應該使用PictureBox1.Refresh()