Esempio n. 1
0
 private void but2_Click(object sender, EventArgs e)
 {
     if (rowCheck() && cellCheck() && palaceCheck())
     {
         MessageBox.Show("恭喜过关");
         clear();
         error            = 0;
         this.label2.Text = "错误次数:" + error;
         printArray(SuDu.getSuDu());
     }
 }
Esempio n. 2
0
 private void btn1_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(this.comboBox1.Text))
     {
         MessageBox.Show("请选择难度");
     }
     else
     {
         clear();
         error            = 0;
         this.label2.Text = "错误次数:" + error;
         printArray(SuDu.getSuDu());
     }
 }
Esempio n. 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //
            // textBox
            //
            int i = 0;

            for (int x = 0; x < 9; x++)
            {
                for (int y = 0; y < 9; y++)
                {
                    i++;
                    TextBox textBox = new TextBox();
                    tbArray[x, y]           = textBox;
                    tbArray[x, y].Name      = x + "," + y;
                    tbArray[x, y].Text      = "";
                    tbArray[x, y].Location  = new Point(12 + x * 30 + x * 3, 12 + y * 30 + y * 3);
                    tbArray[x, y].Size      = new Size(30, 30);
                    tbArray[x, y].Multiline = true;
                    tbArray[x, y].MaxLength = 1;
                    tbArray[x, y].Font      = new Font("宋体", 16F);
                    tbArray[x, y].TextAlign = HorizontalAlignment.Center;
                    tbArray[x, y].KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox_KeyPress);
                    tbArray[x, y].Leave    += new System.EventHandler(this.textBox_Leave);
                    tbArray[x, y].ReadOnly  = true;
                    tbArray[x, y].BackColor = System.Drawing.SystemColors.Info;
                    if (x >= 3 && x < 6 && y >= 3 && y < 6 || x >= 0 && x < 3 && y >= 0 && y < 3 || x >= 6 && x < 9 && y >= 0 && y < 3 || x >= 0 && x < 3 && y >= 6 && y < 9 || x >= 6 && x < 9 && y >= 6 && y < 9)
                    {
                        tbArray[x, y].BackColor = System.Drawing.SystemColors.Window;
                    }
                    //将textBox添加到页面上
                    this.Controls.Add(tbArray[x, y]);
                }
            }
            printArray(SuDu.getSuDu());
        }