Solved

Rotate Image

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
In vb.net, how to eliminate non-numbers in a string? 3 42
Object to array 7 28
Check if number is currency 15 29
Showdialog 8 21
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 …
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

13 Experts available now in Live!

Get 1:1 Help Now