Example #1
0
        private void panel1_Resize(object sender, EventArgs e) //при изменении размеров панели все кнопки автоматически будут растянуты на всю панель
        {
            for (int i = 0; i < 16; i++)                       //цикл размещения кнопок // i-номер кнопки
            {
                int x, y;
                y           = i / 4;     // номер строки
                x           = i - y * 4; // номер столбца
                B[i].Top    = y * panel1.Height / 4;
                B[i].Left   = x * panel1.Width / 4;
                B[i].Width  = panel1.Width / 4;
                B[i].Height = panel1.Height / 4;
                try
                {
                    B[i].Font = new Font("Algerian", panel1.Height / 10, FontStyle.Bold);
                }
                catch
                {
                    this.Width  = 646;
                    this.Height = 433;
                    InitializeComponent();

                    Close();
                    Game3 newForm = new Game3();
                    newForm.Show();

                    MessageBox.Show("Игровое поле не может быть такого размера");
                }
            }
        }
Example #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            Game3 newForm = new Game3();

            newForm.Show();
        }