Zoom Image on UserForm

Todd Bardoni

Well-known Member
Joined
Aug 29, 2002
Messages
3,042
How does one Zoom an Image on a UserForm? The help files say it's possib;e to Zoom, Crop, etc. but I can't find any examples.

Thanks.
Todd
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
there is an option in the properties window called picture size mode...there is a zoom option there.

-Kyle
 
Upvote 0
I've got a UserForm at work where I used a scrollbar to adjust the zoom due to my users having a variety of resolution settings on their monitors. If no one gets you a full answer in the meantime, I'll post back tomorrow.

Regards,
 
Upvote 0
Todd,

Back in the office now. Looks like it's just UserForm.Zoom = ____. Obviously, you don't need to use a scrollbar, you can set the zoom however you need to. But I found this a convenient tool to give the user.

Code on the scrollbar:

Code:
Private Sub ScrollBarZoom_Change()
    UserFormReconcile2.Zoom = ScrollBarZoom.Value
    UserFormReconcile2.LabelZoom = "Zoom = " & ScrollBarZoom.Value
End Sub

Code in UserForm_Initialize

Code:
    ScrollBarZoom.Max = 100
    ScrollBarZoom.Min = 50
    ScrollBarZoom.Value = 100
    UserFormReconcile2.Zoom = 100

In addition to the scrollbar, I have a label beside it that tells the user the zoom factor. In my case, I was trying to make the form run on users that were still on 640 × 480 resolution, so I needed to shrink it. This is rather relevant because zoom does not resize the window. It makes the objects on the form smaller or bigger, but the frame of the window the form is displayed in does not change size. Since I was only shrinking and not enlarging, I didn't try to figure out how to alter the form's window's width & height in order enable it to work well at a zoom > 100.

Hope this is of some help.

(Edit) - I just re-read your post. You're asking about zooming an image on a form, not the image of the form, aren't you? (End-Edit)
Regards,
 
Upvote 0
In for a dime, in for a dollar:

This will resize an image:

<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> CommandButtonGrow_Click()
    <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> Image
    <SPAN style="color:#00007F">Set</SPAN> i = UserForm1.Image1
    i.PictureSizeMode = fmPictureSizeModeZoom
    i.Height = i.Height * 1.1
    i.Width = i.Width * 1.1
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>

<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> CommandButtonShrink_Click()
    <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> Image
    <SPAN style="color:#00007F">Set</SPAN> i = UserForm1.Image1
    i.PictureSizeMode = fmPictureSizeModeZoom
    i.Height = i.Height * 0.9
    i.Width = i.Width * 0.9
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
 
Upvote 0
Thanks. Actually I figured it out. But you did give me the idea of using a scrollbar to adjust the size of the form. Excellent! Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,181
Members
448,871
Latest member
hengshankouniuniu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top