vb.netwinformsuser-controlsflowlayoutpanel

Win Forms User Control Doubling all margins, heights, widths etc when dynamically added to a FlowLayoutPanel


I am dynamically adding multiple user controls to a flowlayoutpanel

when i run the form, the size of the user control has doubled to what it is on the designer.

This is the same for all measurement properties like margins, heights, widths of all controls within the user control.

As for the scale i've seen no warning and other panels/user controls are working correctly in other forms, does this rule out that issue as i'm unsure on how to change DPI-unaware. My user control width is set to exact same width as the FLP width (which works fine on other forms)

User control in designer - enter image description here

User control displayed in form - enter image description here

Its happened before, I can't find anything online but when i deleted and re-added the FLP I had some success. However I have tried recreating the FLP and custom UC and it is still the same. Please help

using vb.net framework 4.7.2


Solution

  • Changing the AutoScaleMode property on the user control from Font to None fixes this issue