Zoom In and Out (1 Viewer)

lmcc007

Registered User.
Local time
Today, 09:57
Joined
Nov 10, 2007
Messages
635
Is there a way to zoom in and out when viewing images?

I am using the below code to display the images:

Public Function DisplayImage(ctlImageControl As Control, strImagePath As Variant) As String

Dim strResult As String
Dim strDatabasePath As String
Dim intSlashLocation As Integer

With ctlImageControl
If IsNull(strImagePath) Then
.Visible = False
strResult = "No image name specified."
Else
If InStr(1, strImagePath, "\") = 0 Then
' Path is relative
strDatabasePath = CurrentProject.FullName
intSlashLocation = InStrRev(strDatabasePath, "\", Len(strDatabasePath))
strDatabasePath = Left(strDatabasePath, intSlashLocation)
strImagePath = strDatabasePath & strImagePath
End If
.Visible = True
.Picture = strImagePath
strResult = "Image found and displayed."
End If
End With


End Function

Thanks!
 
I attached the db to see if there is a way to make it better. I would like to click it to go back to the original size. And use a scrollbar/slider to go up or down in size.

Any ideas?

Thanks!
 

Attachments

I meant have a look on Leban's website to see if you would find a slider tool that does what you've requested. His site has got alot of APIs for imaging.
 
I did but I didn't find anything. I entered scrollbar in Access, but received code for VB, which is:

Max, Min, Zoom Properties, Frame, ScrollBar Controls Example

The following example uses the Zoom property to shrink or enlarge the information displayed on a form, Page, or Frame. This example includes a Frame, a TextBox in the Frame, and a ScrollBar. The magnification level of the Frame changes through Zoom. The user can set Zoom by using the ScrollBar. The TextBox is present to demonstrate the effects of zooming.

This example also uses the Max and Min properties to identify the range of acceptable values for the ScrollBar.

To use this example, copy this sample code to the Declarations portion of a form. Make sure that the form contains:

A Label named Label1.
A ScrollBar named ScrollBar1.
A second Label named Label2.
A Frame named Frame1.
A TextBox named TextBox1 that is located inside Frame1.​

Code:
Private Sub UserForm_Initialize()
    ScrollBar1.Max = 400
    ScrollBar1.Min = 10
    ScrollBar1.Value = 100
    
    Label1.Caption = "10  -----Percent of " _
        & "Original Size---- 400"
    Label2.Caption = ScrollBar1.Value
    
    Frame1.TextBox1.Text = "Enter your text here."
    Frame1.TextBox1.MultiLine = True
    Frame1.TextBox1.WordWrap = True
    
    Frame1.Zoom = ScrollBar1.Value
End Sub

Private Sub ScrollBar1_Change()
    Frame1.Zoom = ScrollBar1.Value
    Label2.Caption = ScrollBar1.Value
End Sub

Can't figure it out to work with slider.
 

Users who are viewing this thread

Back
Top Bottom