private void mode4Button_Click(object sender, EventArgs e) { ChooseImageMode4 form = new ChooseImageMode4(); form.Show(); Program.ac.MainForm = form; this.Close(); }
public Mode4Game(ChooseImageMode4 form, Image picture) { InitializeComponent(); this.mode4 = 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[4, 4] { { button1, button2, button3, button4 }, { button5, button6, button7, button8 }, { button9, button10, button11, button12 }, { button13, button14, button15, button16 } }; for (int i = 0; i < 4; i++) { int startX = 0; for (int j = 0; j < 4; j++) { if (i == 0) { buttonArray[i, j].Image = Crop(image, 150, 150, startX, 0); startX += 150; } else if (i == 1) { buttonArray[i, j].Image = Crop(image, 150, 150, startX, 150); startX += 150; } else if (i == 2) { buttonArray[i, j].Image = Crop(image, 150, 150, startX, 300); startX += 150; } else if (i == 3) { buttonArray[i, j].Image = Crop(image, 150, 150, startX, 450); startX += 150; } } } buttonArray[3, 3].Image = null; buttonArray[3, 3].BackColor = Color.Black; ResizeImage(300, 300); pictureBox.Image = image; string path = Application.StartupPath + @"\Rank4.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; } }