Drag/resize an image on UserForm by the user

A

avi

Hello,

I'm looking for an example/approach for moving and resizing an image
displayed on a userForm, by the user (not in the design phase) by
directly interacting with the image, and not by providing parameters

Is it either doable?

Thanks a lot
Avi
 
G

Guest

You could conceivably do it with code by putting a button on the form which
has preset parameters to unload the current form and redraw it to the preset
parameters. I don't know of a way to drag the changes, but then I'm not the
smartest guy on the block either.
 
R

RB Smissaert

Had a look at this some weeks ago and I think it is doable but very fiddly.

Catch the start of the move or re-size in the mouse_down event.
From the position of the cursor at the mouse-down decide if it is a re-size
or a move you want to start.
Do the move/resize based on the mouse movements.
Catch the mouse_up event and that will stop your action.

I thought it was too fiddly and left it, but if anybody has some nice code
for this then
I would be interested.

RBS
 
R

RB Smissaert

Very nice and thanks for posting that!
Needed to add On Error Resume Next to AxeX and AxeY.
Would there be any problem using this with a Frame?

RBS
 
R

RB Smissaert

Would there be any problem using this with a Frame?

Yes, no trouble with that and as I only needed the drag I could leave some
code out.
Very nice bit of code.

RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top