Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Please help - how to rotate a picture in picturebox

Question posted by: Syoam4ka (Newbie) on July 21st, 2008 09:22 PM
Hi, I have a WinApp in which I have a pictureBox.

I can draw in it like in the paint of windows - I accomplish that with an arrayList of Points and DrawLines method of the Graphics.

So it really paints like in the Paint of windows.
When I let the mouse left button up it stops drawing of course.

Now I want to rotate that paint (which is actually drawn lines isn't it)?

I have a button - btnRotateToLeft and another button - btnRotateToRight.

All what I want to do is to rotate the pic 90 deg for the left/for the right just like in the AdobePhotoShop or any ImageEditor... Nothing more - just that.

But I want it to be done not by saving the drawnlines to a file first and then reloading it with a bitmap to the pictureBox1.Image using the RotateFlip method - I don't want to save it to a file first - but to rotate it at once.

I am pretty new to the graphic part of c# but I do think that the solution should be with creating new points according to the rotation - or just change the position of the existing points in the arrayList.

The problem is I don't know what's the condition for the new position of the new points. They should be surrounding a center point right?

But how to translate all that logic to the code?


Please help me with that - it's an important task in my job.

Please write a code sample for doing that or at least tell me the way or the tools to use. I think it should be with a Matrix but I don't know how to use it at all. Or maybe a 2-demension array? for the points - x,y?

I don't know.

Please help me.


Thank you:)
lathamoulali's Avatar
lathamoulali
Newbie
22 Posts
July 22nd, 2008
08:12 AM
#2

Re: Please help - how to rotate a picture in picturebox
This Site may be helpful for you..http://www.bobpowell.net/animation.htm

Reply
Syoam4ka's Avatar
Syoam4ka
Newbie
30 Posts
July 22nd, 2008
09:55 AM
#3

Re: Please help - how to rotate a picture in picturebox
Quote:
This Site may be helpful for you..http://www.bobpowell.net/animation.htm


Thanks for the link but I don't really understand how to accomplish what I said in my first post - the rotation.

Can anyone write a code sample please or give a link directly to making rotation to the drawn lines in the pictureBox?


Thanks

Reply
Syoam4ka's Avatar
Syoam4ka
Newbie
30 Posts
July 22nd, 2008
01:46 PM
#4

Re: Please help - how to rotate a picture in picturebox
Anyone pleaseeee!! It's urgent!!

Thanks.

Reply
Syoam4ka's Avatar
Syoam4ka
Newbie
30 Posts
July 23rd, 2008
11:17 AM
#5

Re: Please help - how to rotate a picture in picturebox
Hi, I have a WinApp in which I have a pictureBox.

I can draw in it like in the paint of windows - I accomplish that with an arrayList of Points and DrawLines method of the Graphics.

So it really paints like in the Paint of windows.
When I let the mouse left button up it stops drawing of course.

Now I want to rotate that paint (which is actually drawn lines isn't it)?

I have a button - btnRotateToLeft and another button - btnRotateToRight.

All what I want to do is to rotate the pic 90 deg for the left/for the right just like in the AdobePhotoShop or any ImageEditor... Nothing more - just that.

But I want it to be done not by saving the drawnlines to a file first and then reloading it with a bitmap to the pictureBox1.Image using the RotateFlip method - I don't want to save it to a file first - but to rotate it at once.

I am pretty new to the graphic part of c# but I do think that the solution should be with creating new points according to the rotation - or just change the position of the existing points in the arrayList.

The problem is I don't know what's the condition for the new position of the new points. They should be surrounding a center point right?

But how to translate all that logic to the code?


Please help me with that - it's an important task in my job.

Please write a code sample for doing that or at least tell me the way or the tools to use. I think it should be with a Matrix but I don't know how to use it at all. Or maybe a 2-demension array? for the points - x,y?

I don't know.

Please help me.


Thank you:)

Reply
insertAlias's Avatar
insertAlias
Moderator
1,494 Posts
July 23rd, 2008
01:26 PM
#6

Re: Please help - how to rotate a picture in picturebox
Do not double post your questions. It makes it very hard for people to answer you especially if there are answers happening in all the threads you have started because they have to read 2 or more threads in order to see what has already been said. It also swamps the forum with your problem resulting in less attention for the other threads

If you feel that your thread is going unnoticed, after a sufficient time (usually 24 hrs) you should reply to your own thread. This will "bump" it back to the top. No need too create identical threads.

Please read the Posting Guidelines

I have merged your threads.

MODERATOR

Reply
Syoam4ka's Avatar
Syoam4ka
Newbie
30 Posts
July 24th, 2008
01:56 PM
#7

Re: Please help - how to rotate a picture in picturebox
Ok.

Anyone knows how to accomplish that? please...

Reply
tlhintoq's Avatar
tlhintoq
Member
110 Posts
July 25th, 2008
05:31 AM
#8

Re: Please help - how to rotate a picture in picturebox
The project sounds like practicing to learn. Your double posting and 'urgent' need sounds like this is homework to be turned in to your teacher very soon. The posting guidelines indicate this is not a forum for having your homework done for you.

I suggest you show the code you have already written for accomplishing your goal and let someone guide you to where you have made mistakes, but asking people to "write the code for me and post it so I can download it" show a lack of inititive on your part.

Reply
Syoam4ka's Avatar
Syoam4ka
Newbie
30 Posts
July 25th, 2008
07:49 AM
#9

Re: Please help - how to rotate a picture in picturebox
Quote:
The project sounds like practicing to learn. Your double posting and 'urgent' need sounds like this is homework to be turned in to your teacher very soon. The posting guidelines indicate this is not a forum for having your homework done for you.

I suggest you show the code you have already written for accomplishing your goal and let someone guide you to where you have made mistakes, but asking people to "write the code for me and post it so I can download it" show a lack of inititive on your part.


Look dude, you may save your assumptions for yourself alright?
Thank you for you help really.....


I have just graduated high school, I have been working in the asp.net domain,
but now if I want to continue working I have to move to the winforms domain (in the same company...). In asp.net I'm pretty fine, but in winforms I don't know almost anything concerning the GUI. That's why I ask code - learning it takes too much time which I don't have, but when I have code and I see what is used there I have a direction what to learn, otherwise I'll learn things which I may not use in my work perhaps...

I don't have a teacher and it isn't homework... ha ,.... homework.. If it was homework I would ask my teacher to help me you know...

Ever mind I guess I will have to overcome it alone...

Thank you very much.

Reply
Reply
Not the answer you were looking for? Post your question . . .
190,072 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top .NET Forum Contributors