예제 #1
0
        private void mouse_Down(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewDisableButtonCell t = (DataGridViewDisableButtonCell)dataGridView1[e.ColumnIndex, e.RowIndex];

            if (t.Enabled)
            {
                if (e.Button == MouseButtons.Left)
                {
                    btn_Start.BackgroundImage = Properties.Resources.shock;
                }
                else
                {
                    t.Enabled = false;
                    t.Value   = "X";
                    mine_counter--;
                    change_Led();
                }
            }
            else
            {
                if (e.Button == MouseButtons.Right && t.Value == "X")
                {
                    t.Enabled = true;
                    t.Value   = "";
                    mine_counter++;
                    change_Led();
                }
            }
        }
예제 #2
0
        // Override the Clone method so that the Enabled property is copied.
        public override object Clone()
        {
            DataGridViewDisableButtonCell cell =
                (DataGridViewDisableButtonCell)base.Clone();

            cell.Enabled = this.Enabled;
            return(cell);
        }
예제 #3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewDisableButtonCell t = (DataGridViewDisableButtonCell)dataGridView1[e.ColumnIndex, e.RowIndex];

            if (t.Enabled)
            {
                dataGridView1[e.ColumnIndex, e.RowIndex].Value = board[e.ColumnIndex, e.RowIndex].ToString();
                t.Enabled = false;
                btn_Click(e.ColumnIndex, e.RowIndex);
            }
        }