2009-02-13 60 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()