private void GetUserNameForm() { NameMenu = new Form(); NameMenu.MaximizeBox = false; NameMenu.FormBorderStyle = FormBorderStyle.FixedDialog; NameMenu.Name = "NameMenu"; NameMenu.Text = "Minesweeper"; NameMenu.ClientSize = new Size(200, 100); NameMenu.KeyPreview = true; NameMenu.KeyPress += new KeyPressEventHandler(NameMenuKeys); NameMenu.Icon = GameResources.GetIconImage(); Label HSLabel = new Label(); HSLabel.Font = new Font(HSLabel.Font.FontFamily, Single.Parse("14"), FontStyle.Bold); HSLabel.Text = "New High Score!"; HSLabel.TextAlign = ContentAlignment.MiddleCenter; HSLabel.Size = new Size(190, 30); HSLabel.Location = new Point(5, 5); NameMenu.Controls.Add(HSLabel); Label NameLabel = new Label(); NameLabel.Text = "Name"; NameLabel.TextAlign = ContentAlignment.MiddleLeft; NameLabel.Size = new Size(40, 25); NameLabel.Location = new Point(5, 35); NameMenu.Controls.Add(NameLabel); TextBox NameTextBox = new TextBox(); NameTextBox.Name = "NameTextBox"; NameTextBox.Text = Environment.UserName; NameTextBox.Location = new Point(50, 38); NameTextBox.Size = new Size(145, 25); NameTextBox.MaxLength = 10; NameMenu.Controls.Add(NameTextBox); // The Okay Button NoFocusButton OkayButton = new NoFocusButton(); OkayButton.Text = "Ok"; OkayButton.Name = "OkayButton"; OkayButton.Size = new Size(90, 25); OkayButton.Location = new Point(55, 68); OkayButton.Font = new Font(OkayButton.Font.FontFamily, Single.Parse("10")); OkayButton.Click += NameMenuClose; OkayButton.FlatStyle = FlatStyle.Flat; NameMenu.Controls.Add(OkayButton); }
private void AddHeaderObjects() { // Total width 170 +10 for side buffer int offset = (pixelWidth - 158) / 2; TextBox TimerTextBox = new TextBox(); TimerTextBox.Size = new Size(53, 45); TimerTextBox.Location = new Point(offset, 38); TimerTextBox.BackColor = Color.Black; TimerTextBox.ForeColor = ColorTranslator.FromHtml("#39FF14"); TimerTextBox.Name = "TimerTextBox"; TimerTextBox.Font = new Font("Consolas", 18, FontStyle.Bold); TimerTextBox.Text = "9999"; TimerTextBox.ReadOnly = true; TimerTextBox.BorderStyle = BorderStyle.None; GameForm.Controls.Add(TimerTextBox); TextBox ScoreTextBox = new TextBox(); ScoreTextBox.Size = new Size(40, 45); ScoreTextBox.Location = new Point(offset + 118, 38); ScoreTextBox.BackColor = Color.Black; ScoreTextBox.ForeColor = ColorTranslator.FromHtml("#39FF14"); ScoreTextBox.Name = "ScoreTextBox"; ScoreTextBox.Font = new Font("Consolas", 18, FontStyle.Bold); ScoreTextBox.Text = "999"; ScoreTextBox.ReadOnly = true; ScoreTextBox.BorderStyle = BorderStyle.None; GameForm.Controls.Add(ScoreTextBox); NoFocusButton ResetButton = new NoFocusButton(); ResetButton.Size = new Size(45, 35); ResetButton.Location = new Point(offset + 63, 35); ResetButton.Name = "ResetButton"; ResetButton.TextAlign = ContentAlignment.MiddleCenter; ResetButton.Font = new Font(ResetButton.Font.FontFamily, Single.Parse("18"), FontStyle.Bold); ResetButton.Click += DefaultBoardReset; ResetButton.FlatStyle = FlatStyle.Flat; GameForm.Controls.Add(ResetButton); }
public OptionsMenu(int height, int width, int numMines) { // Set the user choices to the default UserChoices = new OptionsMenuData(width, height, numMines); OriginalChoices = new OptionsMenuData(width, height, numMines); // Now build the form OptionsForm = new Form(); OptionsForm.MaximizeBox = false; OptionsForm.FormBorderStyle = FormBorderStyle.FixedDialog; OptionsForm.Name = "OptionsForm"; OptionsForm.Text = "Minesweeper"; OptionsForm.ClientSize = new Size(200, 235); OptionsForm.Icon = GameResources.GetIconImage(); OptionsForm.KeyPreview = true; OptionsForm.KeyPress += new KeyPressEventHandler(MainFormKeyStroke); Label OptionsLabel = new Label(); OptionsLabel.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("14"), FontStyle.Bold); OptionsLabel.Text = "Options"; OptionsLabel.TextAlign = ContentAlignment.MiddleCenter; OptionsLabel.Size = new Size(190, 30); OptionsLabel.Location = new Point(5, 5); OptionsForm.Controls.Add(OptionsLabel); Label OptionsLabelLine = new Label(); OptionsLabelLine.Size = new Size(190, 2); OptionsLabelLine.Location = new Point(5, 37); OptionsLabelLine.BorderStyle = BorderStyle.FixedSingle; OptionsForm.Controls.Add(OptionsLabelLine); //Add the Easy, Medium, Hard, and Custom Radio Buttons // Easy Label EasyLabel = new Label(); EasyLabel.Text = "Easy"; EasyLabel.Size = new Size(60, 25); EasyLabel.Location = new Point(45, 43); EasyLabel.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); OptionsForm.Controls.Add(EasyLabel); RadioButton EasyRadio = new RadioButton(); EasyRadio.Name = "EasyRadio"; EasyRadio.Location = new Point(130, 40); EasyRadio.CheckedChanged += EasyRadio_CheckedChanged; OptionsForm.Controls.Add(EasyRadio); // Medium Label MediumLabel = new Label(); MediumLabel.Text = "Medium"; MediumLabel.Size = new Size(60, 25); MediumLabel.Location = new Point(45, 68); MediumLabel.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); OptionsForm.Controls.Add(MediumLabel); RadioButton MediumRadio = new RadioButton(); MediumRadio.Name = "MediumRadio"; MediumRadio.Location = new Point(130, 65); MediumRadio.CheckedChanged += MediumRadio_CheckedChanged; OptionsForm.Controls.Add(MediumRadio); // Hard Label HardLabel = new Label(); HardLabel.Text = "Hard"; HardLabel.Size = new Size(60, 25); HardLabel.Location = new Point(45, 93); HardLabel.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); OptionsForm.Controls.Add(HardLabel); RadioButton HardRadio = new RadioButton(); HardRadio.Name = "HardRadio"; HardRadio.Location = new Point(130, 90); HardRadio.CheckedChanged += HardRadio_CheckedChanged; OptionsForm.Controls.Add(HardRadio); // Custom Label CustomLabel = new Label(); CustomLabel.Text = "Custom"; CustomLabel.Size = new Size(60, 25); CustomLabel.Location = new Point(45, 118); CustomLabel.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); OptionsForm.Controls.Add(CustomLabel); RadioButton CustomRadio = new RadioButton(); CustomRadio.Name = "CustomRadio"; CustomRadio.Location = new Point(130, 115); CustomRadio.CheckedChanged += CustomRadio_CheckedChanged; OptionsForm.Controls.Add(CustomRadio); // Fields line Label OptionsLabelLine2 = new Label(); OptionsLabelLine2.Size = new Size(190, 2); OptionsLabelLine2.Location = new Point(5, 145); OptionsLabelLine2.BorderStyle = BorderStyle.FixedSingle; OptionsForm.Controls.Add(OptionsLabelLine2); //The Height Field Label HeightLabel = new Label(); HeightLabel.Text = "Height"; HeightLabel.Size = new Size(50, 20); HeightLabel.Location = new Point(14, 152); HeightLabel.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); OptionsForm.Controls.Add(HeightLabel); TextBox HeightTextBox = new TextBox(); HeightTextBox.Name = "HeightTextBox"; HeightTextBox.Location = new Point(69, 150); HeightTextBox.Size = new Size(20, 25); HeightTextBox.ReadOnly = true; HeightTextBox.LostFocus += CalculateCellsMine; OptionsForm.Controls.Add(HeightTextBox); //The Width Field Label WidthLabel = new Label(); WidthLabel.Text = "Width"; WidthLabel.Size = new Size(40, 20); WidthLabel.Location = new Point(94, 152); WidthLabel.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); OptionsForm.Controls.Add(WidthLabel); TextBox WidthTextBox = new TextBox(); WidthTextBox.Name = "WidthTextBox"; WidthTextBox.Location = new Point(156, 150); WidthTextBox.Size = new Size(20, 25); WidthTextBox.ReadOnly = true; WidthTextBox.LostFocus += CalculateCellsMine; OptionsForm.Controls.Add(WidthTextBox); //The Mines Field Label MinesLabel = new Label(); MinesLabel.Text = "Mines"; MinesLabel.Size = new Size(40, 20); MinesLabel.Location = new Point(14, 177); MinesLabel.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); OptionsForm.Controls.Add(MinesLabel); TextBox MinesTextBox = new TextBox(); MinesTextBox.Name = "MinesTextBox"; MinesTextBox.Location = new Point(54, 175); MinesTextBox.Size = new Size(25, 25); MinesTextBox.ReadOnly = true; MinesTextBox.LostFocus += CalculateCellsMine; OptionsForm.Controls.Add(MinesTextBox); //The Cells/Mine Field Label CellMineLabel = new Label(); CellMineLabel.Text = "Cells/Mine"; CellMineLabel.Size = new Size(70, 20); CellMineLabel.Location = new Point(84, 177); CellMineLabel.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); OptionsForm.Controls.Add(CellMineLabel); TextBox CellMineTextBox = new TextBox(); CellMineTextBox.Name = "CellMineTextBox"; CellMineTextBox.Location = new Point(156, 175); CellMineTextBox.Size = new Size(30, 25); CellMineTextBox.ReadOnly = true; OptionsForm.Controls.Add(CellMineTextBox); // The Okay Button NoFocusButton OkayButton = new NoFocusButton(); OkayButton.Text = "Ok"; OkayButton.Name = "OkayButton"; OkayButton.Size = new Size(90, 25); OkayButton.Location = new Point(5, 205); OkayButton.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); OkayButton.Click += OkayButtonAction; OkayButton.FlatStyle = FlatStyle.Flat; OptionsForm.Controls.Add(OkayButton); // The Cancel Button NoFocusButton CancelButton = new NoFocusButton(); CancelButton.Text = "Cancel"; CancelButton.Name = "CancelButton"; CancelButton.Size = new Size(90, 25); CancelButton.Location = new Point(105, 205); CancelButton.Font = new Font(OptionsLabel.Font.FontFamily, Single.Parse("10")); CancelButton.Click += CancelButtonAction; CancelButton.FlatStyle = FlatStyle.Flat; OptionsForm.Controls.Add(CancelButton); }
public AboutMenu() { AboutForm = new Form(); AboutForm.MaximizeBox = false; AboutForm.FormBorderStyle = FormBorderStyle.FixedDialog; AboutForm.Name = "AboutFrom"; AboutForm.Text = "Minesweeper"; AboutForm.ClientSize = new Size(200, 270); AboutForm.KeyPreview = true; AboutForm.KeyPress += new KeyPressEventHandler(AboutMenuClose); AboutForm.Icon = GameResources.GetIconImage(); Label AboutLabel = new Label(); AboutLabel.Font = new Font(AboutLabel.Font.FontFamily, Single.Parse("14"), FontStyle.Bold); AboutLabel.Text = "About"; AboutLabel.TextAlign = ContentAlignment.MiddleCenter; AboutLabel.Size = new Size(190, 30); AboutLabel.Location = new Point(5, 5); AboutForm.Controls.Add(AboutLabel); Label AboutLabelLine = new Label(); AboutLabelLine.Size = new Size(190, 2); AboutLabelLine.Location = new Point(5, 37); AboutLabelLine.BorderStyle = BorderStyle.FixedSingle; AboutForm.Controls.Add(AboutLabelLine); // The Icon Picture PictureBox IconPicture = new PictureBox(); IconPicture.Size = new Size(128, 128); IconPicture.Location = new Point(36, 42); IconPicture.Image = GameResources.GetIconImageSized(128, 128).ToBitmap(); AboutForm.Controls.Add(IconPicture); // The Date Line Label DateLable = new Label(); DateLable.Text = "Created - October 9th 2015"; DateLable.TextAlign = ContentAlignment.MiddleCenter; DateLable.Size = new Size(190, 15); DateLable.Location = new Point(5, 175); AboutForm.Controls.Add(DateLable); // The Author Line Label AuthorLabel = new Label(); AuthorLabel.Text = "Author - Alex Christensen"; AuthorLabel.TextAlign = ContentAlignment.MiddleCenter; AuthorLabel.Size = new Size(190, 15); AuthorLabel.Location = new Point(5, 195); AboutForm.Controls.Add(AuthorLabel); // The Contact Line Label ContactLabel = new Label(); ContactLabel.Text = "*****@*****.**"; ContactLabel.TextAlign = ContentAlignment.MiddleCenter; ContactLabel.Size = new Size(190, 15); ContactLabel.Location = new Point(5, 215); AboutForm.Controls.Add(ContactLabel); // The Okay Button NoFocusButton OkayButton = new NoFocusButton(); OkayButton.Text = "Ok"; OkayButton.Name = "OkayButton"; OkayButton.FlatStyle = FlatStyle.Flat; OkayButton.Size = new Size(90, 25); OkayButton.Location = new Point(55, 240); OkayButton.Font = new Font(OkayButton.Font.FontFamily, Single.Parse("10")); OkayButton.Click += AboutMenuClose; AboutForm.Controls.Add(OkayButton); }
private void BuildStatisticsMenu() { StatisticsMenu = new Form(); StatisticsMenu.MaximizeBox = false; StatisticsMenu.FormBorderStyle = FormBorderStyle.FixedDialog; StatisticsMenu.Name = "StatisticsMenu"; StatisticsMenu.Text = "Minesweeper"; StatisticsMenu.ClientSize = new Size(200, 315); StatisticsMenu.KeyPreview = true; StatisticsMenu.KeyPress += new KeyPressEventHandler(StatisticsMenuClose); StatisticsMenu.Icon = GameResources.GetIconImage(); Label StatsLabel = new Label(); StatsLabel.Font = new Font(StatsLabel.Font.FontFamily, Single.Parse("14"), FontStyle.Bold); StatsLabel.Text = "High Scores"; StatsLabel.TextAlign = ContentAlignment.MiddleCenter; StatsLabel.Size = new Size(190, 30); StatsLabel.Location = new Point(5, 5); StatisticsMenu.Controls.Add(StatsLabel); Label StatsLabelLine = new Label(); StatsLabelLine.Size = new Size(190, 2); StatsLabelLine.Location = new Point(5, 37); StatsLabelLine.BorderStyle = BorderStyle.FixedSingle; StatisticsMenu.Controls.Add(StatsLabelLine); // Easy Stats Label EasyLabel = new Label(); EasyLabel.Text = "Easy"; EasyLabel.Font = new Font(EasyLabel.Font.FontFamily, Single.Parse("10"), FontStyle.Bold); EasyLabel.TextAlign = ContentAlignment.MiddleLeft; EasyLabel.Size = new Size(190, 20); EasyLabel.Location = new Point(5, 42); StatisticsMenu.Controls.Add(EasyLabel); AddScoreLabels(62, 1); // Medium Stats Label MediumLabel = new Label(); MediumLabel.Text = "Medium"; MediumLabel.Font = new Font(MediumLabel.Font.FontFamily, Single.Parse("10"), FontStyle.Bold); MediumLabel.TextAlign = ContentAlignment.MiddleLeft; MediumLabel.Size = new Size(190, 20); MediumLabel.Location = new Point(5, 121); StatisticsMenu.Controls.Add(MediumLabel); AddScoreLabels(141, 2); // Hard Stats Label HardLabel = new Label(); HardLabel.Text = "Hard"; HardLabel.Font = new Font(HardLabel.Font.FontFamily, Single.Parse("10"), FontStyle.Bold); HardLabel.TextAlign = ContentAlignment.MiddleLeft; HardLabel.Size = new Size(190, 20); HardLabel.Location = new Point(5, 200); StatisticsMenu.Controls.Add(HardLabel); AddScoreLabels(220, 3); Label StatsLabelLineTwo = new Label(); StatsLabelLineTwo.Size = new Size(190, 2); StatsLabelLineTwo.Location = new Point(5, 279); StatsLabelLineTwo.BorderStyle = BorderStyle.FixedSingle; StatisticsMenu.Controls.Add(StatsLabelLineTwo); // The Okay Button NoFocusButton OkayButton = new NoFocusButton(); OkayButton.Text = "Ok"; OkayButton.Name = "OkayButton"; OkayButton.Size = new Size(90, 25); OkayButton.Location = new Point(55, 285); OkayButton.Font = new Font(OkayButton.Font.FontFamily, Single.Parse("10")); OkayButton.Click += StatisticsMenuClose; OkayButton.FlatStyle = FlatStyle.Flat; StatisticsMenu.Controls.Add(OkayButton); }