// Override the Clone method so that the Enabled property is copied. public override object Clone() { NewDataGridViewButtonCell cell = (NewDataGridViewButtonCell)base.Clone(); cell.Enabled = this.Enabled; return(cell); }
/// <summary> /// 更新加料中Button的狀態 /// </summary> private void SetAdditionButton() { const int NAME_COLUMN = 1; for (int index = 0; index < _drinkAdditionDataView.Rows.Count; index++) { NewDataGridViewButtonCell cell = (NewDataGridViewButtonCell)_drinkAdditionDataView.Rows[index].Cells[SELECT_BUTTON]; var name = _drinkAdditionDataView.Rows[index].Cells[NAME_COLUMN].Value; cell.Enabled = !_presentationModel.IsAdditionOrdered(name.ToString()) && !_presentationModel.IsOrderedDrinkEmpty(); } _drinkAdditionDataView.Invalidate(); }