using System;
using System.Drawing;
using System.Windows.Forms;

namespace _4_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int i = 0;

        private void button1_Click(object sender, EventArgs e)
        {
            string userName = textBox1.Text;
            string passWord = textBox2.Text;

            if (userName == "Erfan" && passWord == "123456")
            {
                this.Hide();
                new Form2().Show();
            }
            else if (i == 3)
            {
                MessageBox.Show("Bye");
                Application.Exit();
            }
            else
            {
                i++;
                MessageBox.Show("Error");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Font = new Font("Tahoma", 10);
            this.Text = "فرم ورود به برنامه";
            label1.RightToLeft = RightToLeft.Yes;
            label2.RightToLeft = RightToLeft.Yes;
            label1.Text = "نام کاربری:";
            label2.Text = "کلمه عبور:";
            button1.RightToLeft = RightToLeft.Yes;
            button1.Text = "ورود به برنامه";
            button2.RightToLeft = RightToLeft.Yes;
            button2.Text = "خروج";
            textBox2.UseSystemPasswordChar = true;
        }
    }
}