// Override the Clone method so that the Enabled property is copied. public override object Clone() { DataGridViewDisableCheckBoxCell cell = (DataGridViewDisableCheckBoxCell)base.Clone(); cell.Enabled = this.Enabled; return(cell); }
private void dgvRouting_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { for (int i = 0; i < e.RowCount; i++) { DataGridViewRow dgvRow = dgvLinks.Rows[i + e.RowIndex]; CANStreamer otherStream = (CANStreamer)dgvRow.DataBoundItem; if (fromColumn != null) { DataGridViewDisableCheckBoxCell fromCell = (DataGridViewDisableCheckBoxCell)dgvRow.Cells[fromColumn.Index]; fromCell.Value = StreamManager.ConnectionExists(otherStream, thisStream); fromCell.Enabled = (otherStream == thisStream) ? false : otherStream.CanRead; } if (toColumn != null) { DataGridViewDisableCheckBoxCell toCell = (DataGridViewDisableCheckBoxCell)dgvRow.Cells[toColumn.Index]; toCell.Value = StreamManager.ConnectionExists(thisStream, otherStream); toCell.Enabled = (otherStream == thisStream) ? false : otherStream.CanWrite; } } }