コード例 #1
0
        public void ButtonClicked(object sender, MouseEventArgs e)
        {
            if (Opening)
            {
                if (e.Button == MouseButtons.Left)
                {
                    Open();

                    MakeButton btn = sender as MakeButton;

                    btn.isOpen = 5;
                }

                if (e.Button == MouseButtons.Right)
                {
                    this.BackColor = Color.Green;
                    this.Text      = "flag";
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: TrongKim/minesweeper2
        private void CreateButton(int SizeX = 9, int SizeY = 9)
        {
            for (int LocationX = 0; LocationX < SizeX; LocationX++)
            {
                for (int LocationY = 0; LocationY < SizeY; LocationY++)
                {
                    setButton[LocationX, LocationY] = new MakeButton();

                    setButton[LocationX, LocationY].Location = new System.Drawing.Point(LocationX * 30, LocationY * 30);

                    setButton[LocationX, LocationY].Size = new System.Drawing.Size(30, 30);

                    setButton[LocationX, LocationY].isOpen = 0;

                    setButton[LocationX, LocationY].Opening = true;



                    panel1.Controls.Add(setButton[LocationX, LocationY]);
                }
            }
        }