Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Rotate Image

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month6 days, 17 hours left to enroll

783 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