using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Ex5
{
    public partial class Form1 : Form
    {
        int ClickCount = 0;
        bool start;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_DoubleClick(object sender, EventArgs e)
        {
            Cursor.Hide();
            ClickCount = 0;
            lblClickNum.Text = ClickCount.ToString();
            start = true;
        }

        private void label3_Click(object sender, EventArgs e)
        {
            ClickCount++;
            lblClickNum.Text = ClickCount.ToString();

            if (ClickCount <= 5)
            {
                Cursor.Show();
                MessageBox.Show("شما برنده شدید", "تبریک", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClickCount = 0;
                lblClickNum.Text = ClickCount.ToString();
                start = false;
            }
            

        }

        private void Form1_Click(object sender, EventArgs e)
        {
            if (start)
            {
                ClickCount++;
                lblClickNum.Text = ClickCount.ToString();
                if (ClickCount == 5)
                {

                    Cursor.Show();
                    MessageBox.Show("شما بازنده شدید", "بازنده", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    ClickCount = 0;
                    lblClickNum.Text = ClickCount.ToString();
                    start = false;
                }
            }      
          
        }

        
    }
}
