Solved

Rotate Image

Posted on 2008-06-22
4
268 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

724 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