private void mode5Button_Click(object sender, EventArgs e) { ChooseImageMode5 form = new ChooseImageMode5(); form.Show(); Program.ac.MainForm = form; this.Close(); }
public Mode5Game(ChooseImageMode5 form, Image picture) { InitializeComponent(); this.mode5 = form; image = picture; ResizeImage(600, 600); PrivateFontCollection privateFont = new PrivateFontCollection(); privateFont.AddFontFile("./Resources/BMHANNA_11yrs_ttf.ttf"); Font font = new Font(privateFont.Families[0], 18f); timeScoreLabel.Font = font; timeHighScoreLabel.Font = font; buttonArray = new Button[5, 5] { { button1, button2, button3, button4, button5 }, { button6, button7, button8, button9, button10 }, { button11, button12, button13, button14, button15 }, { button16, button17, button18, button19, button20 }, { button21, button22, button23, button24, button25 } }; for (int i = 0; i < 5; i++) { int startX = 0; for (int j = 0; j < 5; j++) { if (i == 0) { buttonArray[i, j].Image = Crop(image, 120, 120, startX, 0); startX += 120; } else if (i == 1) { buttonArray[i, j].Image = Crop(image, 120, 120, startX, 120); startX += 120; } else if (i == 2) { buttonArray[i, j].Image = Crop(image, 120, 120, startX, 240); startX += 120; } else if (i == 3) { buttonArray[i, j].Image = Crop(image, 120, 120, startX, 360); startX += 120; } else if (i == 4) { buttonArray[i, j].Image = Crop(image, 120, 120, startX, 480); startX += 120; } } } buttonArray[4, 4].Image = null; buttonArray[4, 4].BackColor = Color.Black; ResizeImage(300, 300); pictureBox.Image = image; string path = Application.StartupPath + @"\Rank5.txt"; if (!File.Exists((path))) { timeHighScoreLabel.Text = "--.--.--------"; } else { string[] temp = File.ReadAllLines(path); string txt = temp[0]; txt = txt.Substring(0, txt.IndexOf("\t")); timeHighScoreLabel.Text = txt; } }