Solved

Rotate Image

Posted on 2008-06-22
4
253 Views
Last Modified: 2010-04-21
I have a PictureBox that it has backgroudImage
I try to rotate left or right
what I have to do.

 PhotoPictureBox.BackgroundImage.RotateFlip(RotateFlipType.Rotate90FlipX)

does not work
0
Comment
Question by:Ahmadal_najjar2003
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Stephen Manderson earned 500 total points
ID: 21840382
Hi there

The following will do what you need, of course im just working with a background image, so you can change to suit.

Regards
Steve
        Dim picOut As New Bitmap(PictureBox1.BackgroundImage)

        picOut.RotateFlip(RotateFlipType.Rotate90FlipY)

        PictureBox1.BackgroundImage = picOut

Open in new window

0
 

Author Closing Comment

by:Ahmadal_najjar2003
ID: 31469523
Thats right man . Thanks Alot
0
 
LVL 19

Expert Comment

by:Stephen Manderson
ID: 21840462
Your welcome,

This may also be useful to you. Of course just add the combobox "cmbRotationType"

All the best
Steve
Public Class Form1
 

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        cmbRotationType.Items.Add("Rotate180FlipNone")

        cmbRotationType.Items.Add("Rotate180FlipX")

        cmbRotationType.Items.Add("Rotate180FlipXY")

        cmbRotationType.Items.Add("Rotate180FlipY")

        cmbRotationType.Items.Add("Rotate270FlipNone")

        cmbRotationType.Items.Add("Rotate270FlipX")

        cmbRotationType.Items.Add("Rotate270FlipXY")

        cmbRotationType.Items.Add("Rotate270FlipY")

        cmbRotationType.Items.Add("Rotate90FlipNone")

        cmbRotationType.Items.Add("Rotate90FlipX")

        cmbRotationType.Items.Add("Rotate90FlipXY")

        cmbRotationType.Items.Add("Rotate90FlipY")

        cmbRotationType.Items.Add("RotateNoneFlipNone")

        cmbRotationType.Items.Add("RotateNoneFlipX")

        cmbRotationType.Items.Add("RotateNoneFlipXY")

        cmbRotationType.Items.Add("RotateNoneFlipY")

    End Sub
 

    Private Sub RotateImage(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbRotationType.SelectedValueChanged
 

        If cmbRotationType.SelectedIndex < 0 Then Exit Sub
 

        Dim picOut As New Bitmap(PhotoPictureBox.BackgroundImage)
 

        Select Case cmbRotationType.SelectedIndex

            Case 0

                picOut.RotateFlip(RotateFlipType.Rotate180FlipNone)

            Case 1

                picOut.RotateFlip(RotateFlipType.Rotate180FlipX)

            Case 2

                picOut.RotateFlip(RotateFlipType.Rotate180FlipXY)

            Case 3

                picOut.RotateFlip(RotateFlipType.Rotate180FlipY)

            Case 4

                picOut.RotateFlip(RotateFlipType.Rotate270FlipNone)

            Case 5

                picOut.RotateFlip(RotateFlipType.Rotate270FlipX)

            Case 6

                picOut.RotateFlip(RotateFlipType.Rotate270FlipXY)

            Case 7

                picOut.RotateFlip(RotateFlipType.Rotate270FlipY)

            Case 8

                picOut.RotateFlip(RotateFlipType.Rotate90FlipNone)

            Case 9

                picOut.RotateFlip(RotateFlipType.Rotate90FlipX)

            Case 10

                picOut.RotateFlip(RotateFlipType.Rotate90FlipXY)

            Case 11

                picOut.RotateFlip(RotateFlipType.Rotate90FlipY)

            Case 12

                picOut.RotateFlip(RotateFlipType.RotateNoneFlipNone)

            Case 13

                picOut.RotateFlip(RotateFlipType.RotateNoneFlipX)

            Case 14

                picOut.RotateFlip(RotateFlipType.RotateNoneFlipXY)

            Case 15

                picOut.RotateFlip(RotateFlipType.RotateNoneFlipY)

        End Select
 

        PhotoPictureBox.BackgroundImage = picOut

    End Sub
 

End Class

Open in new window

0
 

Author Comment

by:Ahmadal_najjar2003
ID: 21840465
Very Nice Code and all rotation.

Really Thanks Again
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now