コード例 #1
0
ファイル: InputForm.cs プロジェクト: IntelOrca/Snake
        public static string Show(string title, string caption, string defaultText)
        {
            InputForm frm = new InputForm(title, caption, defaultText);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                return(frm.InputText);
            }
            else
            {
                return(defaultText);
            }
        }
コード例 #2
0
        private void selectLevelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LevelSelectForm form = new LevelSelectForm(mLevels);

            form.SelectedLevel = mStartingLevel;
            if (form.ShowDialog() == DialogResult.OK)
            {
                mStartingLevel = form.SelectedLevel;
            }
            return;

            string s  = InputForm.Show("Level select", "Enter the starting level.", mStartingLevel.ToString());
            int    sl = Convert.ToInt32(s);

            if (sl > mHighestLevel || sl < 0)
            {
                MessageBox.Show("This level does not exist!", "Level Select", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                mStartingLevel = sl;
            }
        }