I have a Windows form which consists of 3 files:
AbcFrm.cs
AbcFrm.Designer.cs
AbcFrm.resx
Whenever I do a little change to any properties of datagridview or add new events, the size of the controls grows larger to the right and bottom side and causes some part of the controls to go out of bounds.
I have compared the .Designer.cs file before and after I perform a minor property change (e.g. change a datagridview's tabStop property value from true to false) and discovered some lines/properties were added/changed automatically in the .Designer.cs file :
- some controls'
.Size
value changes
- some controls'
.Location
value changes
- some controls'
.Padding
value changes
- the form's
.AutoScaleDimensions
becomes larger
- the form's
.ClientSize
becomes larger
Edit
I realize when I change the resolution from 150% to 125% and reopen the application, the controls are back in the correct place due to the windows form is now having a larger scaling size. My problem is similar to this question
The cause is that the code might have been edited in a computer with different resolution. However, the solution is not satisfying as it does not solves the problem, only identifying the cause.
How do I prevent this from happening? I'm using Visual Studio 2010 and my OS is Windows 10.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…