Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio 2005 designer moves controls and resizes Form

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

like image 646
tal Avatar asked Jul 21 '09 09:07

tal


People also ask

Is it possible to resize a control within the form design window?

You can resize individual controls, and you can resize multiple controls of the same or different kind, such as Button and GroupBox controls.

How do I see the form design in Visual Studio?

From the Solution Explorer window select your form, right-click, click on View Designer. Voila! The form should display. Save this answer.

What is the name of the windows which you can We can manipulate the form VB design?

VB.Net programmers have made extensive use of forms to build user interfaces. Each time you create a Windows application, Visual Studio will display a default blank form, onto which you can drag and drop controls from the Visual Studio Toolbox window.

What is form Designer in Visual Studio?

Windows Forms Designer in Visual Studio provides a rapid development solution for creating Windows Forms-based applications. Windows Forms Designer lets you easily add controls to a form, arrange them, and write code for their events. For more information about Windows Forms, see Windows Forms overview.


2 Answers

I have been working on this problem for most of today and found some interesting things: The main source of the problem seems to be relying on anchoring. If I use docking to position my controls, instead of anchoring, my problems seem to go away. I found a couple of blog posts from 2003(!), which detail how you might use docking instead of anchoring, and explain how anchoring can break the Windows Forms designer. It seems like this problem might be over 7 years old!

Here are the posts:

  • http://weblogs.asp.net/rweigelt/archive/2003/09/24/28984.aspx
  • http://weblogs.asp.net/rweigelt/archive/2003/10/17/32407.aspx
  • http://weblogs.asp.net/rweigelt/archive/2003/10/23/33181.aspx
like image 160
ryantm Avatar answered Sep 18 '22 12:09

ryantm


This is due to AutoScaleMode-property. Your forms have probably been designed with a different DPI or Font settings than you have now in Windows display settings. AutoScaleMode-property has 4 different possible values : Dpi, Font, Inherit or None. In Dpi or Font mode, your forms and controls will be automatically resized depending on windows display settings.

So, set the AutoScaleMode-property to None in all your forms and controls and they won't be automatically resized anymore. Try to design your forms in order to let sufficient space in every controls so that text will fit even if text size is set to 125%.

like image 22
bN_ Avatar answered Sep 21 '22 12:09

bN_