Show Form in Center
-
i cannt show a form in center of its parent form. i use to show "form1.ShowDialog();" plx help me;
-
i cannt show a form in center of its parent form. i use to show "form1.ShowDialog();" plx help me;
-
but it dose not work. it show at topleft conner. i can solve the problem by setting the properties. plz help..
-
i cannt show a form in center of its parent form. i use to show "form1.ShowDialog();" plx help me;
Hello This should Do it: private void MyShowMethod() { Form1 form = new Form1(); form1.StartPosition = FormStartPosition.Manual; int X = Left + Width / 2 - form1.Width / 2; int Y = Top + Height / 2 - form1.Height / 2; form1.Location = new Point(X, Y); form1.ShowDialog(); } Regards:rose:
-
i cannt show a form in center of its parent form. i use to show "form1.ShowDialog();" plx help me;
Open the form in Visual Studio. Look at the properties for that window. Change StartPosition from WindowsDefaultLocation to CenterParent. :suss: