Click here to Skip to main content
15,880,608 members
Articles / Programming Languages / C#
Tip/Trick

Rotate PictureBox Images in C#

Rate me:
Please Sign up or sign in to vote.
4.87/5 (15 votes)
23 Jan 2012CPOL 77.2K   3   8
How to rotate images in a PictureBox.

You can rotate images in a PictureBox using the following code..


Rotate right:


C#
Image img = pictureBox1.Image;
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
pictureBox1.Image = img;

Rotate left:


C#
Image img = pictureBox1.Image;
img.RotateFlip(RotateFlipType.Rotate270FlipNone);
pictureBox1.Image = img;

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Sri Lanka Sri Lanka
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionRotate Image C++ Code Pin
Member 43393754-Sep-14 5:32
Member 43393754-Sep-14 5:32 
QuestionExactly what I needed Pin
Wakabajashij16-Dec-13 5:52
Wakabajashij16-Dec-13 5:52 
GeneralMy vote of 2 Pin
I Spawn At Home4-Mar-13 20:39
I Spawn At Home4-Mar-13 20:39 
GeneralMy vote of 2 Pin
Abed AlSayed4-Sep-12 4:35
Abed AlSayed4-Sep-12 4:35 
GeneralReason for my vote of 5 Excellent - just what I needed to kn... Pin
Member 19049705-Feb-12 8:59
Member 19049705-Feb-12 8:59 
GeneralRe: Reason for my vote of 5Excellent - just what I needed to kn... Pin
Dhanushka Madushan lk12-Apr-12 16:58
Dhanushka Madushan lk12-Apr-12 16:58 
GeneralIm new to CodeProject...just put it to check.. Pin
Dhanushka Madushan lk24-Jan-12 2:46
Dhanushka Madushan lk24-Jan-12 2:46 
GeneralReason for my vote of 1 pitifully Pin
nobodyxxxxx24-Jan-12 1:14
nobodyxxxxx24-Jan-12 1:14 
Reason for my vote of 1
pitifully

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.