private void gridview_CellStateChanged(System.Object sender, System.Windows.Forms.DataGridViewCellStateChangedEventArgs e) { if (e.StateChanged == DataGridViewElementStates.Selected) { e.Cell.Selected = false; } }
private void OnCellStateChagned(object sender, SWF.DataGridViewCellStateChangedEventArgs args) { if (args.Cell.ColumnIndex == 0 && args.Cell.RowIndex == provider.Row.Index) { RaiseAutomationPropertyChangedEvent(); } }
private void OnCellStateChagned(object sender, SWF.DataGridViewCellStateChangedEventArgs args) { if (args.Cell.ColumnIndex == 0 && args.Cell.RowIndex == provider.Row.Index && provider.DataGridView.SelectedCells.Count == 1 && provider.DataGridViewProvider.IsItemSelected((ListItemProvider)provider)) { RaiseAutomationEvent(); } }
private void OnCellStateChanged(object sender, SWF.DataGridViewCellStateChangedEventArgs args) { if (provider.DataGridViewProvider.DataGridView.SelectedCells.Count == 1 && args.Cell.RowIndex == provider.Cell.RowIndex && args.Cell.ColumnIndex == provider.Cell.ColumnIndex && provider.Cell.Selected) { RaiseAutomationEvent(); } }
private void OnIsReadOnlyProperty(object sender, SWF.DataGridViewCellStateChangedEventArgs args) { bool newValue = args.Cell.ReadOnly; if (args.Cell.ColumnIndex == provider.Cell.ColumnIndex && args.Cell.RowIndex == provider.Cell.RowIndex && isreadonly != newValue) { isreadonly = newValue; RaiseAutomationPropertyChangedEvent(); } }
private void OnCellStateChagned(object sender, SWF.DataGridViewCellStateChangedEventArgs args) { bool selectionStatus = provider.DataGridViewProvider.IsItemSelected((ListItemProvider)provider); if (args.Cell.RowIndex == provider.Row.Index && selected && !selectionStatus && provider.DataGridView.SelectedCells.Count > 1) { RaiseAutomationEvent(); } selected = selectionStatus; }
private void OnCellStateChanged(object sender, SWF.DataGridViewCellStateChangedEventArgs args) { bool selectionStatus = provider.Cell.Selected; if (args.Cell.RowIndex == provider.Cell.RowIndex && wasSelected && !selectionStatus && provider.DataGridViewProvider.DataGridView.SelectedCells.Count > 1) { RaiseAutomationEvent(); } wasSelected = selectionStatus; }
private void OnCellStateChanged(object sender, SWF.DataGridViewCellStateChangedEventArgs args) { bool isSelected = provider.Cell.Selected; if (args.Cell.RowIndex == provider.Cell.RowIndex) { if (wasSelected != isSelected && isSelected && provider.DataGridViewProvider.DataGridView.SelectedCells.Count > 1) { RaiseAutomationEvent(); } wasSelected = isSelected; } }
private void _dgvMA2_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { if (_dgvMA2.Rows.Count > 3 && e.Cell.Selected == true) { sql sql1 = new sql(); DataTable dt1 = new DataTable(); dt1 = sql1.GetRecords("exec fillMASBA @p1, @p2", _dgvMA2.Rows[e.Cell.RowIndex].Cells["ma_id"].Value.ToString(), _dgvMA2.Rows[e.Cell.RowIndex].Cells["db_id"].Value.ToString()); if (_dgvSBA2.Rows != null) { _dgvSBA2.Rows.Clear(); } foreach (DataRow row in dt1.Rows) { _dgvSBA2.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4]); } } }
void gridView_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { if (e.StateChanged == DataGridViewElementStates.Selected) { if (e.Cell.Selected) { contextColumnIndex = e.Cell.ColumnIndex; contextRowIndex = e.Cell.RowIndex; } else if (gridView.SelectedCells.Count > 0) { DataGridViewCell cell = gridView.SelectedCells[gridView.SelectedCells.Count - 1]; contextColumnIndex = cell.ColumnIndex; contextRowIndex = cell.RowIndex; } else { contextColumnIndex = -1; contextRowIndex = -1; } } }
protected virtual void OnCellStateChanged(DataGridViewCellStateChangedEventArgs e) { DataGridViewCell dataGridViewCell = e.Cell; if ((e.StateChanged == DataGridViewElementStates.Selected) && (this.inBulkPaintCount == 0)) { this.InvalidateCellPrivate(dataGridViewCell); } DataGridViewCellStateChangedEventHandler handler = base.Events[EVENT_DATAGRIDVIEWCELLSTATECHANGED] as DataGridViewCellStateChangedEventHandler; if (((handler != null) && !this.dataGridViewOper[0x100000]) && !base.IsDisposed) { handler(this, e); } if ((((e.StateChanged == DataGridViewElementStates.ReadOnly) && (this.ptCurrentCell.X == dataGridViewCell.ColumnIndex)) && ((this.ptCurrentCell.Y == dataGridViewCell.RowIndex) && (dataGridViewCell.RowIndex > -1))) && !this.dataGridViewOper[0x4000]) { base.VerifyImeRestrictedModeChanged(); if (((!dataGridViewCell.ReadOnly && this.ColumnEditable(this.ptCurrentCell.X)) && !this.IsCurrentCellInEditMode) && ((this.EditMode == DataGridViewEditMode.EditOnEnter) || ((this.EditMode != DataGridViewEditMode.EditProgrammatically) && (this.CurrentCellInternal.EditType == null)))) { this.BeginEditInternal(true); } } }
private void dGVResponsables_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { if (dGVResponsables.Columns[e.Cell.ColumnIndex].Name == "ColumnResponsable") { try { string msg = String.Format("Row {0}, Column {1}, {2}", e.Cell.RowIndex, e.Cell.ColumnIndex, e.StateChanged); MessageBox.Show(msg, "Cell State Changed"); for (int i = 0; i < dGVResponsables.Rows.Count; i++) { ((DataGridViewCell)dGVResponsables.Rows[i].Cells["ColumnResponsable"]).Value = false; } string idEmpla = tVEmplacements.SelectedNode.Name.Split(new char[] { '_' })[1]; string idResp = null; //MessageBox.Show( ((bool)((DataGridViewCell)dGVResponsables.Rows[e.Cell.RowIndex].Cells["ColumnResponsable"]).Value).ToString() ); idResp = dGVResponsables.Rows[e.Cell.RowIndex].Tag.ToString(); requete = "update Emplacement set idResp = " + idResp + " where idEmpla = " + idEmpla; if (MaConnexion.ExecuteUpdate(connectionString, requete) != 1) { MessageBox.Show("La modification n'a pas été prise en charge", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception) { } } }
internal void OnDataGridViewElementStateChanged(DataGridViewElement element, int index, DataGridViewElementStates elementState) { DataGridViewColumn dataGridViewColumn = element as DataGridViewColumn; if (dataGridViewColumn != null) { DataGridViewColumnStateChangedEventArgs e = new DataGridViewColumnStateChangedEventArgs(dataGridViewColumn, elementState); this.OnColumnStateChanged(e); } else { DataGridViewRow dataGridViewRow = element as DataGridViewRow; if (dataGridViewRow != null) { if (((base.Events[EVENT_DATAGRIDVIEWROWSTATECHANGED] is DataGridViewRowStateChangedEventHandler) && (dataGridViewRow.DataGridView != null)) && (dataGridViewRow.Index == -1)) { dataGridViewRow = this.Rows[index]; } DataGridViewRowStateChangedEventArgs args2 = new DataGridViewRowStateChangedEventArgs(dataGridViewRow, elementState); this.OnRowStateChanged((dataGridViewRow.Index == -1) ? index : dataGridViewRow.Index, args2); } else { DataGridViewCell dataGridViewCell = element as DataGridViewCell; if (dataGridViewCell != null) { DataGridViewCellStateChangedEventArgs args3 = new DataGridViewCellStateChangedEventArgs(dataGridViewCell, elementState); this.OnCellStateChanged(args3); } } } if ((elementState & DataGridViewElementStates.Selected) == DataGridViewElementStates.Selected) { if (this.noSelectionChangeCount > 0) { this.dataGridViewState2[0x40000] = true; } else { this.OnSelectionChanged(EventArgs.Empty); } } }
private void dataGridView3_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { try { dataGridView3.NotifyCurrentCellDirty(true); int dgv3Row = dataGridView3.Rows.Count; for (int i = 0; i < dgv3Row; i++) { if (dataGridView3.Rows[i].Cells[0].Value != null) //先根据国家查州 { string a = dataGridView3.Rows[i].Cells[0].Value.ToString(); XmlDocument xmldoc = new XmlDocument(); string path = Properties.Resources.chinese;//调用存入内部嵌入资源的archType xmldoc.LoadXml(path); XmlNode node = xmldoc.SelectSingleNode("/Location/*[@Name='" + a + "']");//CountryRegion if (node != null) { XmlNodeList nodes = node.ChildNodes; if (nodes.Count != 1 && nodes.Count != 0) { StateToColumn.Items.Clear(); if (dataGridView3.Rows[i].Cells[0].Selected) { dataGridView3.Rows[i].Cells[1].Value = null; dataGridView3.Rows[i].Cells[2].Value = null; } foreach (XmlNode item in nodes) { StateToColumn.Items.Add(item.Attributes["Name"].Value); } if (dataGridView3.Rows[i].Cells[1].Value != null) //再根据州查市 { string b = dataGridView3.Rows[i].Cells[1].Value.ToString(); //XmlDocument citydoc = new XmlDocument(); //string citypath = Properties.Resources.chinese;//调用存入内部嵌入资源的archType //citydoc.LoadXml(citypath); XmlNode citynode = xmldoc.SelectSingleNode("//State[@Name='" + b + "']");//CountryRegion if (citynode != null) { XmlNodeList citynodes = citynode.ChildNodes; if (citynodes.Count != 0) { CityToColumn.Items.Clear(); if (dataGridView3.Rows[i].Cells[1].Selected)//还有种方式就是IsInEditMode,编辑完毕以后,但是得点击一下才有效果 { dataGridView3.Rows[i].Cells[2].Value = null; } foreach (XmlNode item in citynodes)//得到所有城市节点 { CityToColumn.Items.Add(item.Attributes["Name"].Value); } } } } } else { StateToColumn.Items.Clear(); CityToColumn.Items.Clear(); dataGridView3.Rows[i].Cells[1].Value = ""; XmlNode nullState = node.SelectSingleNode("State"); XmlNodeList nullStateCity = nullState.ChildNodes; foreach (XmlNode item in nullStateCity) { CityToColumn.Items.Add(item.Attributes["Name"].Value); } } } } } } catch { } }
private void sampleDataGridView_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { if (((e.StateChanged & DataGridViewElementStates.Selected) != DataGridViewElementStates.None) && ((e.Cell.State & DataGridViewElementStates.Selected) != DataGridViewElementStates.None)) { this.sampleDataGridView.ClearSelection(); } }
/// <include file='doc\DataGridView.uex' path='docs/doc[@for="DataGridView.OnCellStateChanged"]/*' /> protected virtual void OnCellStateChanged(DataGridViewCellStateChangedEventArgs e) { // At this point we assume that only the Selected state has an influence on the rendering of the cell. // If there is a scenario where another state has an effect, then the dev will have to invalidate the cell by hand. DataGridViewCell dataGridViewCell = e.Cell; if (e.StateChanged == DataGridViewElementStates.Selected) { Debug.Assert(dataGridViewCell.RowIndex >= 0); if (this.inBulkPaintCount == 0) { InvalidateCellPrivate(dataGridViewCell); } } DataGridViewCellStateChangedEventHandler eh = Events[EVENT_DATAGRIDVIEWCELLSTATECHANGED] as DataGridViewCellStateChangedEventHandler; if (eh != null && !this.dataGridViewOper[DATAGRIDVIEWOPER_inDispose] && !this.IsDisposed) { eh(this, e); } if (e.StateChanged == DataGridViewElementStates.ReadOnly && this.ptCurrentCell.X == dataGridViewCell.ColumnIndex && this.ptCurrentCell.Y == dataGridViewCell.RowIndex && dataGridViewCell.RowIndex > -1 && !this.dataGridViewOper[DATAGRIDVIEWOPER_inReadOnlyChange]) { VerifyImeRestrictedModeChanged(); if (!dataGridViewCell.ReadOnly && ColumnEditable(this.ptCurrentCell.X) && !this.IsCurrentCellInEditMode && (this.EditMode == DataGridViewEditMode.EditOnEnter || (this.EditMode != DataGridViewEditMode.EditProgrammatically && this.CurrentCellInternal.EditType == null))) { // Current cell becomes read/write. Enter editing mode. BeginEditInternal(true /*selectAll*/); } } }
/// <summary> /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed. /// <example> /// datagridviewcellstatechangedeventhandler.BeginInvoke(sender, e, callback); /// </example> /// </summary> public static IAsyncResult BeginInvoke(this DataGridViewCellStateChangedEventHandler datagridviewcellstatechangedeventhandler, Object sender, DataGridViewCellStateChangedEventArgs e, AsyncCallback callback) { if(datagridviewcellstatechangedeventhandler == null) throw new ArgumentNullException("datagridviewcellstatechangedeventhandler"); return datagridviewcellstatechangedeventhandler.BeginInvoke(sender, e, callback, null); }
private void colourGrid_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { if (e.Cell.ColumnIndex == 0) { e.Cell.Selected = false; colourGrid.Rows[e.Cell.RowIndex].Cells[1].Selected = true; } }
private void table_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { if (e.Cell == null || e.StateChanged != DataGridViewElementStates.Selected) { return; } e.Cell.Selected = false; }
protected virtual void OnCellStateChanged(DataGridViewCellStateChangedEventArgs e);
private void _dgv8_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { if (_dgv8.Rows.Count > 3 && e.Cell.Selected == true) { Sql sql1 = new Sql(); DataTable dt1 = new DataTable(); if (_dgv8.Rows[e.Cell.RowIndex].DefaultCellStyle.BackColor == bbgreen3) { string userID = "0"; if (cbUsersMA.Visible) userID = cbUsersMA.SelectedValue.ToString(); string reg = "0"; if (globalData.Region == String.Empty) { if (cbRegMA.Visible) reg = cbRegMA.SelectedValue.ToString(); } else reg = globalData.Region; string lpu = "-1"; if (cbLPUMA.Visible && cbLPUMA.SelectedItem != null) lpu = cbLPUMA.SelectedValue.ToString(); dt1 = sql1.GetRecords("exec fillMASBA_All @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10", globalData.Div, globalData.RD, userID, reg, lpu, cbYearMA.SelectedItem.ToString(), _dgv8.Rows[e.Cell.RowIndex].Cells["ma_fact1"].Value.ToString().Replace(",", "."), _dgv8.Rows[e.Cell.RowIndex].Cells["ma_fact2"].Value.ToString().Replace(",", "."), _dgv8.Rows[e.Cell.RowIndex].Cells["ma_fact3"].Value.ToString().Replace(",", "."), _dgv8.Rows[e.Cell.RowIndex].Cells["ma_fact4"].Value.ToString().Replace(",", ".")); } else dt1 = sql1.GetRecords("exec fillMASBA @p1, @p2", _dgv8.Rows[e.Cell.RowIndex].Cells["ma_id"].Value.ToString(), _dgv8.Rows[e.Cell.RowIndex].Cells["db_id"].Value.ToString()); if (_dgvUpd.Rows != null) { _dgvUpd.Rows.Clear(); } foreach (DataRow row in dt1.Rows) { _dgvUpd.Rows.Add(row.ItemArray[0], row.ItemArray[1], row.ItemArray[2], row.ItemArray[3], row.ItemArray[4]); } } }
private void dgwExperiment_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { }
private void TerminalCellModification(object sender, DataGridViewCellStateChangedEventArgs e) { DataModified(); }
private void dgAssessment_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { RefreshDataGridView(true); }
internal void OnDataGridViewElementStateChanged(DataGridViewElement element, int index, DataGridViewElementStates elementState) { DataGridViewColumn dataGridViewColumn = element as DataGridViewColumn; if (dataGridViewColumn != null) { DataGridViewColumnStateChangedEventArgs dgvcsce = new DataGridViewColumnStateChangedEventArgs(dataGridViewColumn, elementState); OnColumnStateChanged(dgvcsce); } else { DataGridViewRow dataGridViewRow = element as DataGridViewRow; if (dataGridViewRow != null) { DataGridViewRowStateChangedEventHandler eh = this.Events[EVENT_DATAGRIDVIEWROWSTATECHANGED] as DataGridViewRowStateChangedEventHandler; if (eh != null && dataGridViewRow.DataGridView != null && dataGridViewRow.Index == -1) { dataGridViewRow = this.Rows[index]; } DataGridViewRowStateChangedEventArgs dgvrsce = new DataGridViewRowStateChangedEventArgs(dataGridViewRow, elementState); OnRowStateChanged(dataGridViewRow.Index == -1 ? index : dataGridViewRow.Index, dgvrsce); } else { DataGridViewCell dataGridViewCell = element as DataGridViewCell; if (dataGridViewCell != null) { DataGridViewCellStateChangedEventArgs dgvcsce = new DataGridViewCellStateChangedEventArgs(dataGridViewCell, elementState); OnCellStateChanged(dgvcsce); } } } if ((elementState & DataGridViewElementStates.Selected) == DataGridViewElementStates.Selected) { if (this.noSelectionChangeCount > 0) { this.dataGridViewState2[DATAGRIDVIEWSTATE2_raiseSelectionChanged] = true; } else { OnSelectionChanged(EventArgs.Empty); } } }
private void itemPenjualanDataGridView_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { calculate(); }
private void dataGridView2_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { try { dataGridView2.NotifyCurrentCellDirty(true); } catch { } }
private void calculationAppartaments_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { }
private void playersGrid_CellStateChanged( object sender, DataGridViewCellStateChangedEventArgs e ) { if ( playersGrid.Rows.Count <= 0 || playersGrid.SelectedCells.Count <= 0 ) { return; } bool isMultiple = false; int selectedRowIndex = this.playersGrid.SelectedCells[0].OwningRow.Index; foreach ( DataGridViewCell cell in this.playersGrid.SelectedCells ) { if ( cell.OwningRow.Index != selectedRowIndex ) { isMultiple = true; break; } } if ( isMultiple ) { this.btnViewPlayerDetails.Enabled = false; } else { this.btnViewPlayerDetails.Enabled = true; } }
private void ClearContext(object sender, DataGridViewCellStateChangedEventArgs e) { _toolStripMenu.Clear(); }
private void transitionsDataGridView_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { int currentRow = e.Cell.RowIndex; int currentColumn = e.Cell.ColumnIndex; if (currentColumn == 5) { if (this.transitionsDataGridView.Rows[currentRow].Cells[0].Value != null && this.transitionsDataGridView.Rows[currentRow].Cells[1].Value != null) { string from = this.transitionsDataGridView.Rows[currentRow].Cells[0].Value.ToString(); string to = this.transitionsDataGridView.Rows[currentRow].Cells[1].Value.ToString(); if (this.toTheSameState(from, to)) { this.transitionsDataGridView.Rows[currentRow].Cells[5].ReadOnly = false; } else { this.transitionsDataGridView.Rows[currentRow].Cells[5].ReadOnly = true; } } } }
internal void OnCellStateChangedInternal (DataGridViewCellStateChangedEventArgs e) { this.OnCellStateChanged (e); }
private void dataGridView1_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { if((e.Cell.ColumnIndex == 0) && (e.StateChanged == DataGridViewElementStates.Selected)) { dgvHash.Rows[e.Cell.RowIndex].Cells[1].Selected = dgvHash.Rows[e.Cell.RowIndex].Cells[2].Selected = e.Cell.Selected; } }
private void dGVResponsables_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { if (dGVResponsables.Columns[e.Cell.ColumnIndex].Name == "ColumnResponsable") { try { for (int i = 0; i < dGVResponsables.Rows.Count; i++) { ((DataGridViewCell)dGVResponsables.Rows[i].Cells["ColumnResponsable"]).Value = false; } requete = "update Site set idResp = " + dGVResponsables.Rows[e.Cell.RowIndex].Tag.ToString() + " where idSite = " + ((structSite)lBSites.SelectedItem).Idsite; if (MaConnexion.ExecuteUpdate(connectionString, requete) != 1) { MessageBox.Show("La modification n'a pas été prise en charge", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception) { } } }
protected virtual void OnCellStateChanged (DataGridViewCellStateChangedEventArgs e) { DataGridViewCellStateChangedEventHandler eh = (DataGridViewCellStateChangedEventHandler)(Events [CellStateChangedEvent]); if (eh != null) eh (this, e); }
private void itemGrid_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) { }