Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Rotate Image

Posted on 2008-06-22
4
Medium Priority
?
275 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

688 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