private void SetDataGridViewAppearence() { TableTag tableTag = this.tableDataGridView.Tag as TableTag; if (tableTag != null) { foreach (DataGridViewRow dataGridViewRow in ((System.Collections.IEnumerable) this.tableDataGridView.Rows)) { RowTag rowTag = dataGridViewRow.Tag as RowTag; if (rowTag != null && rowTag.NotExist) { if (!tableTag.IsAllowCreate) { dataGridViewRow.DefaultCellStyle = this.m_toBeDeleteStyle; } else { this.SetAllCellsState(dataGridViewRow); } } else if (tableTag.IsCustomTable || tableTag.isReadOnly) { dataGridViewRow.ReadOnly = true; dataGridViewRow.DefaultCellStyle = this.m_readOnlyStyle; } else { this.SetAllCellsState(dataGridViewRow); } } } }
private void tableDataGridView_SelectionChanged(object sender, System.EventArgs e) { bool flag = this.tableDataGridView.SelectedRows.Count > 0; foreach (DataGridViewRow dataGridViewRow in this.tableDataGridView.SelectedRows) { RowTag rowTag = dataGridViewRow.Tag as RowTag; if (rowTag != null && rowTag.Equals(RowTag.AnOldRowExist)) { flag = false; } } this.copyToolStripButton.Enabled = (this.tableDataGridView.SelectedRows.Count > 0); if (flag) { this.pasteToolStripButton.Enabled = Clipboard.ContainsText(); this.cutToolStripButton.Enabled = true; this.deleteToolStripButton.Enabled = true; return; } this.pasteToolStripButton.Enabled = false; this.cutToolStripButton.Enabled = false; this.deleteToolStripButton.Enabled = false; }
static RowTag() { RowTag.s_aNewRow = new RowTag(true, true, true); RowTag.s_anOldRowExist = new RowTag(false, false, false); }