views:

82

answers:

2

I'm stumped by some bizarre behavior in Visual Studio's forms editor. I have seen this on a couple of different forms in my application. Each time I open the form in Visual Studio's layout editor some controls will be in a different location than when I left them. Typically some buttons move up just a little bit from the lower right corner. But its not just buttons, in one case its a container panel that moves. I have to reposition them then save and close the form. I've confirmed that it is the layout editor actually changing the Location property when the form is opened because if I save and close the form with the buttons in the correct position they will be correct at runtime.

This is not a problem with the Anchor or Dock properties not being set correctly. The editor is actually changing the Location property of my control(s). I've looked at the .designer.cs file and I do not see anything unusual. I've tried deleting and recreating these controls but the problem persists.

Any ideas what I can do?

Its not a show stopper I just have to be very careful to fix the controls manually every time I open it in the winforms layout editor.

Edit: Visual Studio will actually checkout the file automatically to set the Location to what it stubbornly thinks it should be.

A: 

Its most likely an issue related to DPI. Check the designer.cs for an AutoScaleMode property and try changing it (or adding one) to set the form.AutoscaleMode = Font

PaulG
It was already set to AutoScaleMode = Font, the same as all of my other forms.
Brian Ensink
A: 

Try locking the controls in design mode and then see how it goes.

P.K
I neglected to mention it but I tried that.
Brian Ensink