Example #1
0
        private void label2_Click(object sender, EventArgs e)
        {
            using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(new Bitmap(1, 1)))
            {
                SizeF size = graphics.MeasureString(textBox1.Text.Trim(), new Font("Agency FB", 12, FontStyle.Regular, GraphicsUnit.Point));

                if (size.Width > 40)
                {
                    MessageBox.Show("Alegeti un nume mai scurt!");
                }
                else
                {
                    if (textBox1.Text.Trim() == "" || (rbtnmica.Checked == rbtnmedie.Checked == rbtnmare.Checked == false))
                    {
                        MessageBox.Show("Completati cu numele si selectati o dificultate!");
                    }
                    else
                    {
                        if (rbtnmica.Checked == true)
                        {
                            frmJoc = new FrmJoc(1, textBox1.Text.Trim());
                            frmJoc.Show();
                        }
                        else if (rbtnmedie.Checked == true)
                        {
                            frmJoc = new FrmJoc(2, textBox1.Text.Trim());
                            frmJoc.Show();
                        }
                        else if (rbtnmare.Checked == true)
                        {
                            frmJoc = new FrmJoc(3, textBox1.Text.Trim());
                            frmJoc.Show();
                        }


                        this.Close();
                    }
                }
            }
        }
Example #2
0
        private void label18_Click(object sender, EventArgs e)
        {
            if (zero == false)
            {
                timerDecrement.Enabled = false;
                foreach (Label c in this.Controls.OfType <Label>())
                {
                    if (Convert.ToString(c.Tag) == "cuv")
                    {
                        c.Visible = false;
                    }
                }

                if (MessageBox.Show("Jocul nu s-a terminat, vei pierde scorul obtinut pana acum!\nEsti sigur ca vrei sa incepi din nou?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    this.Close();
                    FrmJoc frm = new FrmJoc(dificultate, nume);
                    frm.Show();
                }
                else
                {
                    timerDecrement.Enabled = true;
                    foreach (Label c in this.Controls.OfType <Label>())
                    {
                        if (Convert.ToString(c.Tag) == "cuv")
                        {
                            c.Visible = true;
                        }
                    }
                }
            }
            else
            {
                this.Close();
                FrmJoc frm = new FrmJoc(dificultate, nume);
                frm.Show();
            }
        }