//自定义 public void show4() { this.Hide(); string xm; string[] a; int[] b = new int[3]; xm = Interaction.InputBox("请以逗号分隔输入的行数、列数、雷数:", "自定义"); a = xm.Split(','); for (int i = 0; i < a.Length; i++) { b[i] = Convert.ToInt32(a[i]); } //加载窗体显示 timer2.Enabled = true; l.Show(); my.Hide(); //在panel中展示扫雷区 this.panel1.Controls.Clear(); PublicValue.lie = b[0]; PublicValue.line = b[1]; PublicValue.Minenumber = b[2]; Minebound s1 = new Minebound(); s1.bound(); s1.setMine(); s1.setSaoMao(); }
int cstatus, zstatus, gstatus, lstatus; //解决难度加载问题 private void Form1_Load(object sender, EventArgs e) { if (o > 4) { MessageBox.Show("bbbbb"); } //定义一个全局变量,当菜单某难度加载一次后++,load事件中,加载菜单难度方法 cstatus = zstatus = gstatus = lstatus = 0; if (cstatus > 0) { show1(); } else if (zstatus > 0) { show2(); } else if (gstatus > 0) { show3(); } else if (lstatus > 0) { show4(); } else { this.panel1.Controls.Clear(); PublicValue.lie = 13; PublicValue.line = 10; PublicValue.Minenumber = 15; Minebound s1 = new Minebound(); s1.bound(); s1.setMine(); s1.setSaoMao(); } //图标载入 Bitmap myBitmap = new Bitmap(Application.StartupPath + "\\images\\icon.jpg"); // Get an Hicon for myBitmap. IntPtr Hicon = myBitmap.GetHicon(); // Create a new icon from the handle. Icon newIcon = Icon.FromHandle(Hicon); // Set the form Icon attribute to the new icon. this.Icon = newIcon; //中间图片居中 int x = (int)(0.5 * (this.Width - pictureBox1.Width)); int y = pictureBox1.Location.Y; pictureBox1.Location = new System.Drawing.Point(x, y); //雷记数器 x = (int)((this.Width - pictureBox1.Width) - 64); y = pictureBox1.Location.Y; textBox2.Location = new System.Drawing.Point(x, y); textBox2.Text = PublicValue.Minenumber.ToString(); }
public void show3() { this.Hide(); timer2.Enabled = true; l.Show(); my.Hide(); //在panel中展示扫雷区 this.panel1.Controls.Clear(); PublicValue.lie = 25; PublicValue.line = 20; PublicValue.Minenumber = 80; Minebound s1 = new Minebound(); s1.bound(); s1.setMine(); s1.setSaoMao(); }