Reputation: 27713
Here's a complete simple case:
The Button is not in the correct place when executing (though it is in the Designer).
UserControl
Designer:
Form
Designer:
Executing:
Executing, resized. As you can see, that doesn't help:
I tried changing my computer's text size from 125% to 100% but that didn't help either. Windows 10, VS 2017, .Net 4.7.1. I also tried setting the UserControl's Dock in its Load
and ParentChanged
event handlers, and its constructor. No change.
So how do I get the button to stay anchored?
EDIT (it seems to be somehow related to text size being different than 100%)
After a lot of fiddling I see now that after I change to 100% size text (In the Settings app under System-Display. Including logging off and on), clean and rebuild the solution, and then change back to 125% it works for some time. I can't find the exact limit for that.
Upvotes: 1
Views: 780
Reputation: 181
@ispiro, could you please try to disable DPI awareness on your VisualStudio process and see if it helps. Here is a blog post that specifies the registry key to set: https://code4ward.net/2016/11/29/visual-studio-winforms-designer-on-highdpi/
Upvotes: 1