Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Center Form on Startup

Tags:

c#

.net

winforms

I'm working on a web browser in C#, so I made a splash screen for it. However, the splash screen isn't located at the center of the screen when it starts up. So is there a way to center the form on startup?

enter image description here

Working code:

public splash()
    {
        InitializeComponent();

        StartPosition = FormStartPosition.CenterScreen;
    }
like image 652
pcnThird Avatar asked Dec 22 '12 23:12

pcnThird


People also ask

How do you center a form on a screen?

To center your form in the application screen, open the form in design view. View the Form Properties. Set the "Auto Center" property to "Yes".

How do I change my startup form?

Specify the default form in Access OptionsClick the File tab, and then under Help, click Options. Click Current Database. Under Application Options, in the Display Form list, select the form that you want to display when the database starts. Click OK, and then close and reopen the database to display the startup form.

How do you make a form not visible?

Press F5 to build and run the application. Click on the button in the main form to display the sub form. Now, when you press the button in the sub form, the form will be hidden.


1 Answers

StartPosition = FormStartPosition.CenterScreen;

MSDN FormStartPosition Documentation

like image 75
debracey Avatar answered Sep 26 '22 21:09

debracey