Chris
Chris

Reputation: 27384

Unwanted Form modifications when using VS designer

I am having some issues with the form designer in VS2010.

Everytime I open this project VS modifies certain form values, specifically related to splitter distances. If I undo changes via Pending Changes tab it reloads then instantly makes the modification again!

What has gone wrong?

Upvotes: 1

Views: 130

Answers (1)

Hans Passant
Hans Passant

Reputation: 941217

The SplitterDistance property setter overrides the value you give it, based on the panels' MinSize property. This will happen at design time as well as runtime. Adjust the Panel1 and Panel2 MinSize property as necessary.

Something else you want to keep an eye on is the AutoScaleDimensions assignment in the form's InitializeComponents() method as written in the form's Designer.cs file. Compare it to the value you see when you create a new project from scratch. If there's a mismatch then the form was originally designed on a machine with a different video adapter DPI setting. The form's AutoScaleMode tries to correct for that, at design time as well as runtime. Which can have lots of side effects, including the SplitterDistance property setter behavior.

Upvotes: 1

Related Questions