Esempio n. 1
0
        private void btHoanTat_Click(object sender, EventArgs e)
        {
            if (tbLoiGiai.Text == "COWF LAU 711")
            {
                tbLoiGiai.Enabled = false;
                btHoanTat.Enabled = false;
                tbLoiGiai.UseSystemPasswordChar = true;

                Form_ThongDiep frm = new Form_ThongDiep();
                frm.ShowDialog();

                this.Dispose();
            }
            else
            {
                SubFunction.SetError(lbError, lbError.Location.Y, gbLoiGiai.Size, "Lời giải không chính xác! Vui lòng thử lại.");
            }
        }
Esempio n. 2
0
        private void btGuess_Click(object sender, EventArgs e)
        {
            if (TestSo(tbGuess.Text))
            {
                if (TestSoHopLe(tbGuess.Text))
                {
                    string sResult = getResult(tbNumber.Text, tbGuess.Text);

                    int tempX, tempY;
                    if (iSteps % 10 == 0)
                    {
                        ilbStep_Position = 0;
                    }

                    if (iSteps < 10)
                    {
                        tempX = 20;
                        tempY = 20 * ilbStep_Position;
                    }
                    else
                    {
                        tempX = pnGame.Width - 30 - TextRenderer.MeasureText(sResult, this.Font).Width;
                        tempY = 20 * ilbStep_Position;
                    }

                    iSteps++;
                    ilbStep_Position++;

                    if (sResult == "WIN")
                    {
                        //SubFunction.SetError(lbError_Play, lbError_Play.Location.Y, gbPlay.Size, "YOU ARE WINNER :)");
                        uc_cdt.Enabled = false;

                        tbNumber.UseSystemPasswordChar = false;
                        gbPlay.Enabled = false;

                        //uc_HuongDan.Visible = false;
                        //gbThongDiep.Visible = true;

                        Form_ThongDiep frm = new Form_ThongDiep();
                        frm.ShowDialog();

                        //return;
                        this.Dispose();
                    }
                    else
                    {
                        AddStep(sResult, tempX, tempY);
                        lbRemain.Text = "Số lần còn lại: " + (iMaxSteps - iSteps).ToString();

                        tbGuess.Text = "";
                        tbGuess.Focus();
                    }

                    if (iSteps == iMaxSteps)
                    {
                        SubFunction.SetError(lbError_Play, lbError_Play.Location.Y, gbPlay.Size, "Hết lượt đoán. Vui lòng thử lại!");

                        tbNumber.UseSystemPasswordChar = false;
                        gbPlay.Enabled = false;

                        gbCreate.Enabled = true;
                        uc_cdt.Enabled = false;

                        btPlay.Enabled = true;
                    }
                }
                else
                {
                    SubFunction.SetError(lbError_Play, lbError_Play.Location.Y, new Size(gbPlay.Width, gbPlay.Height), "Các chữ số phải khác nhau!");
                }
            }
            else
            {
                SubFunction.SetError(lbError_Play, lbError_Play.Location.Y, new Size(gbPlay.Width, gbPlay.Height), "Tắt bộ gõ dấu tiếng Việt!");
            }
        }
Esempio n. 3
0
        private void btThongDiep_Click(object sender, EventArgs e)
        {
            Form_ThongDiep frm = new Form_ThongDiep();
            frm.ShowDialog();

            //InitForm();
            this.Dispose();
        }