views:

447

answers:

2

When i open a form in visual studio 2005 (c#) the designer automaticaly resize the form and move/resize controls without touching the designer at all. The source file is changed and when i close the designer i'm asked to save the *.cs file. I tried to look into visual studio options without any success. any ideas? visual studio setup or something? thanks, Tal

A: 

This is one you should live with. Even in VS2008 such things happen from time to time. It is mostly depends on form content (controls, positions, etc), and there is no option in VS to disable such behavior.

When you open your form in designer, vs runtime rebuilds visual appearance from code behind. And sometimes it made changes at this moment. Also when you are simply adding one control to form, designer fully rebuilds codebehind and resource files. This is well known issue, and seems that MS won't fix it, because they move in WPF direction.

So several points to simplify your life:

  1. Move to VS2008, designer were more consistent, but still shuffle controls in .designer.cs file
  2. Place your code in one of the source repositories, so if you accidentally saved such form, you can restore it from repositary.
arbiter
thanks arbiter.-well, moving to 2008 isn't relevant for my project (involves too many code at this time).
tal
VS2005->2008 migration is not problematic at all.
Tamás Szelei
+1  A: 

I found a work around.

not sure what happens behind but i changed my display properties. and it works fine. here is the sequence: display propertis->settings tab->advance. in the the advance dialog i changed the "DPI Settings" from Large (120dpi) to Normal (96 dpi)

tal
that's awful that the IDE designer is affected by your screen DPI. Sorry to hear that. :(
Saul Dolgin
Of the many horrors perpetuated by Windows, 'DPI settings' is one of the worst. This setting causes more problems with more applications than almost anything else that I have seen.
Stewbob