I have a startup screen in my application that I want to show with StartupPosition = CenterScreen and WindowState=Normal. All works fine, but if, for instance, the user creates a shortcut to my application and sets Run=Maximized, then the startup screen becomes maximized instead of normal and I want to disable this behavior. Is there any way to completely disable form from being maximized or override startup state given to application?
I've tried forcing StartupPosition and WindowState, but this doesn't work as the window just ends up on the top-left of the screen.
Doing some tests I found 2 ways to disable the window from being maximized due to Run=Maximized on startup: A) show a dummy form, close it, then load actual startup form B) add the following the the Form.Load:
if (WindowState != FormWindowState.Normal)
{
WindowState = FormWindowState.Normal;
Rectangle r = Screen.GetWorkingArea(this);
Location = new Point(r.X + ((r.Width - Width) / 2), r.Y + ((r.Height - Height) / 2));
}
I know there should be an actual method of disabling form from starting maximized because if I show a message box before my startup form the message box shows up normally and then so does my startup form, but without showing the message box my startup screen wants to be maximized.