Results 1 to 4 of 4

Thread: Zoom image on form

  1. #1

    Zoom image on form

    I have a continuous form with an image box in each row. Theimages are saved at 400 X 400px BUT sometimes they are a little different dueto its original size so it might be like 300 X 400px or similar. Anyways, Iwould like to click on my image box (imgJobStep) and the image would eitheropen another form OR enlarge the image box I clicked on to a proportional size.I found the code below but not sure how to use it, will it work?

    I would rather have the image box (imgJobStep) enlarge tothe left when clicked on and go back to normal when enlarged when clicked onagain if possible.

      Dim newHeight As Integer, newWidth
       Dim curHeight As Property, curWidth As Property
       Dim Ratio As Single, Multiplier As Single
       Set curWidth = Me!FrameName.Properties("Width")
       Set curHeight = Me!FrameName.Properties("Height")
       Ratio = curWidth / curHeight 'Proportionality Factor
       Multiplier = 1.05
       newWidth = curWidth * Multiplier
       newHeight = newWidth / Ratio 'Maintain Porportionality
       If newHeight < 31680 And newWidth < 31680 Then
          curWidth = newWidth
          curHeight = newHeight
       End If
       Set curWidth = Nothing
       Set curHeight = Nothing

  2. #2
    VBAX Guru
    Mar 2005
    I don't see any reason why it shouldnt work, you can use a fixed size of your choice as well, also using left and top to position it or open a new form in which the image takes up the whole form or you can use the image media program to view as an original full screen image.
    I normally use the last one, but have also used a purpose made form as well, which can just be closed like any other form.
    A lot would depend on how many images you have on the original form that would need manipulating.
    If you manipulate the size you may have to ensure that it is also "on top" with "bring to front" to prevent it mixing with other fields.

  3. #3
    Sorry OBP I was off work for a few days.... I made an example for you to see. What itís doing when I click on the image is expanding allimages instead of the one being clicked on. Second its not enlarging to thecenter/left and you must click it each time you want it larger. I just wantedto click on the image and have that image move to center in a larger size toget a better view of it. Thoughts?
    Attached Files Attached Files

  4. #4
    VBAX Guru
    Mar 2005
    I have used one of my databases to test my code I use a text box called text20 that holds either yes or no and uses it to switch sizes.
    My image is called photo1 and this code changes the size and position, note that the dimensions use twips in the vba code so you will ahve to play around a bit to get your image the sizes you want 1" =1440 twips.
    You will probably want use the code in the forms On current event to set the default size.
    If Me.Text20 = "yes" Then
    Me.Text20 = "no"
    Me.Photo1.Width = 2880
    Me.Photo1.Height = 2880
    Me.Photo1.Top = 1000
    Me.Photo1.Left = 5000
    Me.Text20 = "yes"
    Me.Photo1.Width = 5000
    Me.Photo1.Height = 5000
    Me.Photo1.Top = 1000
    Me.Photo1.Left = 4000
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts