• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Visual c# express windows forms designer going crazy

Mark R

Diamond Member
I've got a complex win forms project - lots of forms, user controls, etc.

The main form contains mutiple tab pages, various other containers (panels, splitters, etc), etc.

Something very odd has started happening with random controls in the tab pages randomly moving around (often off the screen - e.g. to coordinate position -1425,-8521), or changing size (usually to zero size). It's getting to the point where I move the controls to the correct position, rebuild the project, and everything works great.

Then I make a trivial change to a bit of code (e.g. a bit of an algorithm, tweak an FFT or something) and next time I run the project, half the controls will have gone walkies.

Any idea what is going on?

The controls that are moving around are often completely passive (e.g. labels) or something where the only interaction is getting a value (e.g. a comboBox or a trackbar). Usercontrols and things are also affected, unless the control is docked to its container - docked controls work fine. Undocked controls go crazy. Controls that are not in a container (e.g. directly on the form) work fine.
 
I think I've fixed it.

It turns out that setting "large fonts" or a non-standard font size in Windows causes the Visual Studio visual designer to go completely nuts, if the font settings are later changed.

Basically, I briefly experimented with changing the font size, and must have edited the project in that mode, before reverting the windows settings. However, that was enough to make the visual designer go batshit mental.

I fixed it by changing the AutoScaleMode property on the forms to "None".
 
I think I've fixed it.

It turns out that setting "large fonts" or a non-standard font size in Windows causes the Visual Studio visual designer to go completely nuts, if the font settings are later changed.

Basically, I briefly experimented with changing the font size, and must have edited the project in that mode, before reverting the windows settings. However, that was enough to make the visual designer go batshit mental.

I fixed it by changing the AutoScaleMode property on the forms to "None".

Hopefully you don't allow resizing of the window in the app.
 
Hopefully you don't allow resizing of the window in the app.

I do. It works beautifully.
And I've left enough space for large fonts to work too - so you can use large fonts, but it prevents the window being rescaled when a high dpi mode is used.
 
Back
Top