Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        private void dgvInventoryStocks_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvInventoryStocks.Columns[e.ColumnIndex].Name == "quantity")
            {
                DataGridViewDisableButtonCell buttonCell =
                    (DataGridViewDisableButtonCell)dgvInventoryStocks.
                    Rows[e.RowIndex].Cells["get_stock"];

                int quantity = (int)dgvInventoryStocks[dgvInventoryStocks.Columns["quantity"].Index, e.RowIndex].Value;
                buttonCell.Enabled = (quantity < 1) ? true : false;

                dgvInventoryStocks.Invalidate();
            }
        }