Visual c# express windows forms designer going crazy

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
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.
 

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
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".
 

KLin

Lifer
Feb 29, 2000
30,951
1,077
126
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.
 

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
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.