I need to rotate a picture box 180 degrees when a condition in my if statement is met. Is this possible?
+2
A:
I'll assume that you want to rotate the image inside, because rotating the box itself doesn't make much sense (and is impossible anyway).
Try this:
myPictureBox.Image.RotateFlip(RotateFlipType.Rotate180FlipNone);
Thomas
2009-02-13 04:04:29
A:
You grasp the concepts for C++ as given in http://www.codeproject.com/KB/cpp/rimage.aspx and may use for VB.net as given in http://www.eggheadcafe.com/community/aspnet/14/10053817/rotating-picturebox-contr.aspx
lakshmanaraj
2009-02-13 04:06:35
Thes sites were helpful - Thanks!
2009-02-15 04:26:34
A:
The System.Drawing.Image.RotateFlip() method allows you to rotate the actual image displayed in the picturebox. See 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
Ash
2009-02-13 04:09:21