Solved

Rotate Image

Posted on 2008-06-22
4
255 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

772 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