Esempio n. 1
0
        //changes the usercontrol on the form and centers it
        public static void ChangeScreen(UserControl current, string next)
        {
            Form f = ActiveForm.FindForm();

            f.Controls.Remove(current);
            UserControl ns = null;

            switch (next)
            {
            case "MenuScreen":
                ns = new MenuScreen();
                break;

            case "GameScreen":
                ns = new GameScreen();
                break;

            case "ScoreScreen":
                ns = new ScoreScreen();
                break;

            default:
                break;
            }
            ns.Location = new Point((f.Width - ns.Width) / 2, (f.Height - ns.Height) / 2);
            f.Controls.Add(ns);
            ns.Focus();
        }