Пример #1
0
        public static void changeScreen(UserControl current, string next)
        {
            //tmp is set to the form that this control is on
            Form tmp = current.FindForm();

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

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

            case "TutorialScreen":
                ns = new tutorialScreen();
                break;

            case "TitleScreen":
                ns = new titleScreen();
                break;

            case "EndScreen":
                ns = new endScreen();
                break;
            }

            ns.Size     = new Size(controlWidth, controlHeight);
            ns.Location = startCentre;
            tmp.Controls.Add(ns);
            ns.Focus();
        }
Пример #2
0
        public startupForm()
        {
            InitializeComponent();
            this.WindowState = FormWindowState.Maximized;

            titleScreen mm = new titleScreen();

            // set the menu to display centre screen based on screen size defaults
            mm.Size     = new Size(screenControl.controlWidth, screenControl.controlHeight);
            mm.Location = screenControl.startCentre;

            // add main menu screen to form
            this.Controls.Add(mm);
        }