I want to show my WinApp in the center of the screen, so I set the StartPosition property to CenterScreen , but the window does not appear in the center of the screen.
What about him? Did I miss something?
PS:
I show the window from the main window and using the button.
Edit:
The code I use to show the window.
Form_CO form_CO = new Form_CO(); void button_CO_Click(object sender, EventArgs e) { try { //StaticVariables.Form_CO_IsShown is to prevent opening the same multiple windows if (!StaticVariables.Form_CO_IsShown) { form_CO = new Form_CO(); form_CO.Show(); StaticVariables.Form_CO_IsShown = true; } else { form_CO.WindowState = FormWindowState.Normal; form_CO.Activate(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
source share