Rotate image

Discussions about document viewing.
Post Reply
Hellerup
Posts: 1
Joined: Thu Feb 24, 2011 3:53 pm

Rotate image

Post by Hellerup » Thu Feb 24, 2011 4:34 pm

Hi

I have an imageviewer on my form used for displaying multipage TIff-files. I am trying to create an OCX in VB6.

My problem is that some images are scanned (not using GDTwain - using an external source) sideways or upside down. The user then rotates the image in the viewer and I store the rotate-information and rotate the page accordingly when the user changes pages.

What happens is that the image is loaded upside down, and then rotated. This means that the viewer flashes the upside-down-image briefly, before it rotates it, giving a dizzying result. Normally I would lock the imagecontrol using code as follows:

Code: Select all

    
Private Sub Command1_Click()
    With GdViewer1
        .LockControl = True
        .LicenseKey = ("XXX")
        .DisplayFromFile ("C:\God-000074.tif")
        .Rotate270
        .LockControl = False
        .Redraw
    End With
End Sub
The problem here is that Redraw ignores any settings to rotate, meaning that the image is still displayed upside down. Refresh apparently does nothing. I cannot modify the image at runtime (it is readonly) so I'm stumped as to what I can do to prevent the viewer from displaying the file uspide down first, when I cant use LockControl.

The code above is simplified. Normally I have buttons for rotating and I catch the Pagechange event to rotate the image.

Hope someone can help or point in the right direction.

Kind Regards

Martin Hellerup Madsen
Systems Engineer

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Rotate image

Post by Loïc » Thu Feb 24, 2011 4:47 pm

Hi,

You have 2 solutions:

1- hide scrollbars
2- Use Imaging class:

Code: Select all

 Imaging1.CreateImageFromFile ("C:\aa.png")
 Imaging1.Rotate (Rotate270FlipNone)
 GdViewer1.SetNativeImage (Imaging1.GetNativeImage)
Note: Please try to don't write your license key here. i had to remove it.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests