The problem is this: after resizing the form and adding a pair of elements when the program starts, the form is displayed less than needed. The FormBorderStyle property FormBorderStyle set to FixedDialog . The window is displayed in the correct size if you set it to Sizable . After searching, I found that in ClientSize Designer.cs ClientSize property sets the size smaller, when I changed it to the desired one (371, 256) , the window became the correct size, but at the same time in the Size property, the values ​​became larger (389, 303) and the designer became larger than necessary. What could be the problem?

enter image description here enter image description here

  • one
    Size - the size with a border, ClientSize - without a border. - Alexander Petrov
  • 2
    If it is a little more precise, then Size is the external size of the form, including the header and border, the size of which depends on the style of the form itself and the style of the OS (Aero for example). ClientSize - the size of the area in which child controls and other form content are drawn. These sizes are always different. - rdorn

1 answer 1

I noticed that Visual Studio suffers from a disease that sometimes randomly changes something in the Designer.cs file. The solution turned out to be the following: I opened the same file from the old version of the program and replaced the line with this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F) with this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F) , after which everything was in place.