Nick
Nick

Reputation: 162

How do I avoid unintentional reshaping of an image in a userform?

I have a userform in excel which is used to "log in" certain usertypes.

Under the control box and the textbox, I have an "img" that I use as a button. I do this instead of a "normal" button because it looks better.

The issue is that when I press the login button the "img" reshapes (see 2nd screenshot). This does not happen on my computer, but rather if it's used on a different computer.

I have no code whatsoever that reshapes the button so after scouring the web for some answers I believe it has something to do with the DPI of the different computers/monitors.

Is there a way to solve this so that the "img" doesn't reshape?

Noted behavior: When I press the button (img) the button reshapes and the macro is NOT run. Then, when I press the small button, the macro runs.

Tried solutions that do not work:

  1. button.width = button.width
  2. button.width = 150
  3. button.widht = password.width

enter image description here

enter image description here

Upvotes: 0

Views: 101

Answers (1)

Nick
Nick

Reputation: 162

The simple solution that worked for my case was:

Inserting a transparent label above the image. Meaning that I actually press the label instead of the Image.

I moved the code so that it activates on the label_click instead of the Image_click.

Upvotes: 1

Related Questions