Automatically resize user at runtime

I have a user control that has a shortcut and a text box, but I cannot determine why they are always overridden at runtime. Here is a snapshot:

design time

run time

as you can see ... the objects were changed and the interval was changed. I don’t think this is due to my code ... Is it just the vb.net settings? Please, help.

+4
source share
4 answers

I just found the answer to my question. Instead of a user control, I change the AutoScaleMode form (container) to Form to None . Thanks to all! Hooray!

+4
source

Please check the value of the Anchor property in your text boxes, labels, and buttons inside the user control. It is probably set to maintain a distance from the right border of its container (usercontrol).

+4
source

Try using the AutoScaleMode property of the user control, if the Font value is set , change it to None .

In ocations, a container (maybe a form) has a font size and a type different from the user control, and if the user control has this property set to Font , it will try to resize to cover the new font type and size.

+4
source

I was able to replicate your problem. I created a user control and tried hard for a long time to try to resize it. The original split container was added to my user management as you suggested you did, but I just couldn't get it to resize.

I thought that in the Dafault 3,3,3,3 field there might be something to do about it. When I initially added my container with a section, it was smaller than a user control that could not recreate the problem.

If my split-conainer and my user control were the same width, then the margins were more obvious, and this led to an increase in the width of my user control.

Of course, your problem may be completely unrelated to this, but I would suggest checking your fields against the widths of the controls. I appreciate that the fields may be absolutely necessary for you, but why not delete them, at least if it is just to check if this fixes your problem. Or by ensuring that the width of your separation container is less than the width of the user control after subtracting the margin on each side. For example, if your user control has a width of 300, and your separation container has fields 3,3,3,3, then check that your separation container is less than 300-3-3 = 294.

Just a theory, in fact, may not be useful .... Good luck.

+2
source

All Articles