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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

zoom on images

Status
Not open for further replies.

wdverner

Technical User
Mar 10, 2005
160
GB
Good morning all,
I have created a form to allow users to zoom in on an image, though I get an error if they click zoom in too many times!

"the control or sub form is too large for this location"

Is there any way of counting the number of times a user clicks the button? All the drawings are various sizes so i cant do an If width becomes too big etc.

Suggestions anyone?

Thanks guys
 
under the form VBA create a Public clicktimes as integer
under the click event under the button place clicktimes=clicktimes+1

This way you'll know :)

grtz Flippertje
 
How are ya wdverner . . . . .

What [blue]Object[/blue] are you using for display and how are you zooming?

Calvin.gif
See Ya! . . . . . .
 
Hit submitt too soon.

Whats the size of the files your displaying?

Calvin.gif
See Ya! . . . . . .
 
I use a pop up form with a frame to display the image.

I simply create a command button to increase the image size by multiplying the dimensions by a value.

The size of my files... dimension wise they vary, when the form opens they are set at a size. The butons then multiply this width by 1.05.

I guess I need something to hit a cut off point...e.g. if width = 20 then stop?
 
wdverner . . . . .

Sorry to get back so late.

[blue]Your exceeding the maximum specified width for a form of 22 inches![/blue]

Just keep it under 22.

Calvin.gif
See Ya! . . . . . .
 
Hi aceman, thanks for the info, forgot about max form width.

can you set up an IF statement to check form width hasnt been exceeded?

Thanks,
 
wdverner . . . . .

In a button on the [blue]zoom form[/blue] try this ([blue]you![/blue] substitute proper names in [purple]purple[/purple]):
Code:
[blue]   Dim newHeight As Integer, newWidth
   Dim curHeight As Property, curWidth As Property
   Dim Ratio As Single, Multiplier As Single
   
   Set curWidth = Me![purple][b]FrameName[/b][/purple].Properties("Width")
   Set curHeight = Me![purple][b]FrameName[/b][/purple].Properties("Height")
   Ratio = curWidth / curHeight [green]'Proportionality Factor[/green]
   Multiplier = 1.05
   
   newWidth = curWidth * Multiplier
   newHeight = newWidth / Ratio [green]'Maintain Porportionality[/green]
   
   If newHeight < 31680 And newWidth < 31680 Then
      curWidth = newWidth
      curHeight = newHeight
   Else
      MsgBox "MAXIMUM ZOOM ATTAINED!"
   End If
   
   Set curWidth = Nothing
   Set curHeight = Nothing[/blue]
[blue]Thats it . . . give it a whirl and let me know . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top