Every time I open my form, it defaults to 328×192. I’ll change it to 328×170, save my project, close my project, then reopen it.
All of a sudden, my form is back to 328×192 instead of the size I saved it as (328×170).
I went into my Form.Designer.cs and tried adding this line of code:
this.Size = new System.Drawing.Size(328, 170);
And still, when I reopen the project, the form is at 328×192. I don’t know where this value is coming from and it’s driving me crazy. The weird part about this problem is that it seems to occur randomly, where I will get that extra margin on the bottom of my form. I’m worried this will slip into production because even when I save it to the correct dimensions, when I reopen it, it’s back to the wrong dimensions.
Needless to say, GUI errors make my work look 1000% worse no matter how things are under the hood.
Do not edit the designer-generated code. The designer doesn’t save the Size property, it isn’t a good measure for the size of the form. The height of the caption bar of the form is determined by user preference. It saves the ClientSize property instead. That’s an important one since it determines how much room is available to controls.
It isn’t otherwise obvious what made the size revert. Could be something as simple as forgetting to check-in the changes which then lead you on the wild Size goose chase.