Graphics Question

01-28-2005, 04:36 AM
I know this has probably been done to death somewhere else, but I can't seem to get my head around it.

I have a form with a picturebox on it, which I use to load a jpeg. Now what I want to do (probably using GDI+) is to rotate the picture in the picturebox by 90 degrees either way and then save the resulting picture. I've seen some examples here which allow you to rotate jpegs, which I looked at, but that was on a form. It was what I wanted, but not in a picturebox

I hope you can understand this and I've not been too waffly

01-28-2005, 05:37 AM
Change Form1 or Me to Picture1 in example you found. I must work!

01-28-2005, 06:21 AM
I did that and it partially worked. It's now rotating the image on the form, but it's using my picturebox to do it. I think the following two lines of code are the ones I need help with

graphics.CreateFromHDC Picture1.hDC
bitmap.CreateFromHBitmap Picture.Handle ' create a bitmap from the image on the form

They are copied from a code posted here.

01-29-2005, 05:29 AM
What might be confusing you is that it is not your image that is being rotated. It is the surface that the image is on. ie the picturebox.

01-31-2005, 06:56 AM
you can use a free library to make this.

02-01-2005, 02:37 AM
Ok I'll try to explain a bit better. My users have got digital cameras, and obviously some photos they take in landscape mode and some in portrait mode, but cameras always show in landscape. I've got a form which loads up the photos, so my users can see the photos, and rename them if needed. Now if they need them rotated they come to me and I use photoshop to rotate them.
What I want to do is stick a couple of buttons on this form, so they press the relevant button and the photo is automatically rotated and saved.

Can anyone help?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum