In the Form Load event I'm adding some controls to the Form dynamically.
I use this code to resize the Form to adapt its Size to the its new content:
this.MaximumSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
this.AutoSize = true;
this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
It works fine but StartPosition = FormStartPosition.CenterScreen doesn't work as expected:
the Form center position is calculated based on the original size.