Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to rotate a image or picturebox 90º ? 2

Status
Not open for further replies.

Nashrg

Technical User
Jun 11, 2001
5
There's how to rotate a image or picturebox control 90º? I'm a newbie and don't know how to do this.
 
Sorry, I want to rotate a picture inside in one of these controls 90º and not the control.
 
Actually, it isn't easy since neither of the controls you mention support rotation. Here's an example of one workaround (this just illustrates the technique for a Picture Box, but it works for the Image control as well with some minor alteration):

Add the Wang (or Kodak) Image Edit component to your project, and drop an ImgEdit control onto your form. Set its visible property to false.

Place a picture box and a command button onto the form. Set the Picture property of the picture box to the image you want (do this at design time or at run time, it doesn't matter). Also, set the AutoSize property to True

Add the following code to your form:
[tt]
Option Explicit

Private Function Rotate(ctlPicture As PictureBox) As StdPicture
Dim picX As Long
Dim picY As Long
Dim OldBorderStyle As Long

' Remove any birders if they exist
OldBorderStyle = ctlPicture.BorderStyle
ctlPicture.BorderStyle = 0

picX = ctlPicture.Image.Width
picY = ctlPicture.Image.Height
Clipboard.Clear
Clipboard.SetData ctlPicture.Picture

ImgEdit1.FitTo 3, True
'ImgEdit1.Zoom = 20
ImgEdit1.DisplayBlankImage ctlPicture.Width / Screen.TwipsPerPixelX, ctlPicture.Height / Screen.TwipsPerPixelY, , , 6

ImgEdit1.ClipboardPaste
ImgEdit1.CompletePaste
ImgEdit1.RotateLeft
Clipboard.Clear
ImgEdit1.ClipboardCopy 0, 0, picX, picY
ctlPicture.Picture = Clipboard.GetData
ctlPicture.BorderStyle = OldBorderStyle
End Function

Private Sub Command1_Click()
Rotate Picture1
End Sub
 
This post has been very helpful to me - I am successfully rotating an image using the imgedit control as you have outlined.

But...when I try to run the app on an older machine, the image gets distorted (and "zooms in") during rotation. I think it's because the imgedit.ocx is out of date.

I have 2 questions:
1. How do I use the package and deployment wizard to distritbute the correct files for using the imgedit control?
2. Where can I find documentation for the imgedit control - I do not see it in MSDN library.

Thanks,
bas
 
See
I quote:

IMGEDIT is considered part of the Windows operating system. End users must have Wang/Kodak Imaging installed as an accessory. This control is not for redistribution, so the control must already be present on the destination machines for any projects that use it.


There is some blurb on the MSDN site referred from this page
Let me know if this helps
________________________________________________________________
If you are worried about how to post, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Sounds like I can't update this imgedit.ocx on the Windows98 machines? I'd like the Windows98 machines to have the same version as my Windows2000 development machine.
 
1. Do not distribute the control. If the client PC doesn't have it, then they can install it from the Windows CD.
I do not think it will work under XP. I haven't had time to verify this yet.

2. Then look for and select in the left window for the menu item "Graphics and Multimedia"
Then select "Imaging for Windows" [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Here is also an example:
Section: Multimedia & Graphics / Picture Rotation

(Change to value of:
angle = [1]Pi / X[/i]
to a lower value in order to rotate more.

Here is also a MS example:

And another one:
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top