protected override void OnMouseDown(DataGridViewCellMouseEventArgs e) { base.OnMouseDown(e); linkState = LinkState.Active; DataGridView.InvalidateCell(this); }
private void ToggleCheckState() { CheckState cs = GetCurrentValue(); if (threeState) { if (cs == CheckState.Indeterminate) { editingCellFormattedValue = CheckState.Unchecked; } else if (cs == CheckState.Checked) { editingCellFormattedValue = CheckState.Indeterminate; } else { editingCellFormattedValue = CheckState.Checked; } } else { if (cs == CheckState.Checked) { editingCellFormattedValue = false; } else { editingCellFormattedValue = true; } } editingCellValueChanged = true; DataGridView.InvalidateCell(this); }
protected override void OnMouseLeave(int rowIndex) { if (DataGridView is null) { return; } if (mouseInContentBounds) { mouseInContentBounds = false; if (ColumnIndex >= 0 && rowIndex >= 0 && (DataGridView.ApplyVisualStylesToInnerCells || FlatStyle == FlatStyle.Flat || FlatStyle == FlatStyle.Popup)) { DataGridView.InvalidateCell(ColumnIndex, rowIndex); } } if ((ButtonState & ButtonState.Pushed) != 0 && ColumnIndex == DataGridView.MouseDownCellAddress.X && rowIndex == DataGridView.MouseDownCellAddress.Y) { UpdateButtonState(ButtonState & ~ButtonState.Pushed, rowIndex); } }
protected override void OnMouseUp(DataGridViewCellMouseEventArgs e) { base.OnMouseUp(e); linkState = LinkState.Hover; LinkVisited = true; DataGridView.InvalidateCell(this); }
protected override void OnMouseUp(DataGridViewCellMouseEventArgs e) { if ((e.Button & MouseButtons.Left) == MouseButtons.Left) { button_state = PushButtonState.Normal; DataGridView.InvalidateCell(this); } }
protected override void OnKeyUp(KeyEventArgs e, int rowIndex) { if ((e.KeyData & Keys.Space) == Keys.Space) { linkState = LinkState.Normal; DataGridView.InvalidateCell(this); } }
protected override void OnMouseMove(DataGridViewCellMouseEventArgs e) { if (!ReadOnly && check_state != PushButtonState.Normal && check_state != PushButtonState.Hot) { check_state = PushButtonState.Hot; DataGridView.InvalidateCell(this); } }
protected override void OnLeave(int rowIndex, bool throughMouseClick) { if (!ReadOnly && check_state != PushButtonState.Normal) { check_state = PushButtonState.Normal; DataGridView.InvalidateCell(this); } }
private void UpdateButtonState(ButtonState newButtonState, int rowIndex) { if (ButtonState != newButtonState) { ButtonState = newButtonState; DataGridView.InvalidateCell(ColumnIndex, rowIndex); } }
protected override void OnMouseLeave(int rowIndex) { base.OnMouseLeave(rowIndex); linkState = LinkState.Normal; DataGridView.InvalidateCell(this); DataGridView.Cursor = parent_cursor; }
protected override void OnMouseLeave(int rowIndex) { if (button_state != PushButtonState.Normal) { button_state = PushButtonState.Normal; DataGridView.InvalidateCell(this); } }
protected override void OnKeyUp(KeyEventArgs e, int rowIndex) { // when activated by the SPACE key, this method updates the cell's user interface if (!ReadOnly && (e.KeyData & Keys.Space) == Keys.Space) { check_state = PushButtonState.Normal; DataGridView.InvalidateCell(this); } }
protected override void OnMouseUp(DataGridViewCellMouseEventArgs e) { // if activated by the left mouse button, this method updates the cell's user interface if (!ReadOnly && (e.Button & MouseButtons.Left) == MouseButtons.Left) { check_state = PushButtonState.Normal; DataGridView.InvalidateCell(this); } }
protected override void OnMouseLeave(int rowIndex) { // if the cell's button is not in its normal state, this method causes the cell's user interface to be updated. if (!ReadOnly && check_state != PushButtonState.Normal) { check_state = PushButtonState.Normal; DataGridView.InvalidateCell(this); } }
protected override void OnKeyDown(KeyEventArgs e, int rowIndex) { // when activated by the SPACE key, this method updates the cell's user interface if ((e.KeyData & Keys.Space) == Keys.Space) { button_state = PushButtonState.Pressed; DataGridView.InvalidateCell(this); } }
protected override void OnMouseMove(DataGridViewCellMouseEventArgs e) { base.OnMouseMove(e); if (linkState != LinkState.Hover) { linkState = LinkState.Hover; DataGridView.InvalidateCell(this); parent_cursor = DataGridView.Cursor; DataGridView.Cursor = Cursors.Hand; } }
protected override void OnMouseDown(DataGridViewCellMouseEventArgs e) { if (DataGridView == null) { return; } if (LinkBoundsContainPoint(e.X, e.Y, e.RowIndex)) { LinkState |= LinkState.Active; DataGridView.InvalidateCell(ColumnIndex, e.RowIndex); } base.OnMouseDown(e); }
protected override void OnMouseLeave(int rowIndex) { if (DataGridView == null) { return; } if (DataGridView.ApplyVisualStylesToHeaderCells) { if (ButtonState != ButtonState.Normal) { Debug.Assert(ButtonState == ButtonState.Pushed); Debug.Assert(ColumnIndex == DataGridView.MouseDownCellAddress.X); Debug.Assert(rowIndex == DataGridView.MouseDownCellAddress.Y); UpdateButtonState(ButtonState.Normal, rowIndex); } DataGridView.InvalidateCell(ColumnIndex, rowIndex); } }
protected override void OnMouseEnter(int rowIndex) { if (DataGridView == null) { return; } if (DataGridView.ApplyVisualStylesToHeaderCells) { if (ColumnIndex == DataGridView.MouseDownCellAddress.X && rowIndex == DataGridView.MouseDownCellAddress.Y && ButtonState == ButtonState.Normal && Control.MouseButtons == MouseButtons.Left && !DataGridView.ResizingOperationAboutToStart) { UpdateButtonState(ButtonState.Pushed, rowIndex); } DataGridView.InvalidateCell(ColumnIndex, rowIndex); } }
protected override void OnMouseLeave(int rowIndex) { if (DataGridView == null) { return; } if (dataGridViewCursor != null) { DataGridView.Cursor = dataGridViewCursor; dataGridViewCursor = null; } if (LinkState != LinkState.Normal) { LinkState = LinkState.Normal; DataGridView.InvalidateCell(ColumnIndex, rowIndex); } base.OnMouseLeave(rowIndex); }
public override void DoDefaultAction() { DataGridViewCheckBoxCell dataGridViewCell = (DataGridViewCheckBoxCell)Owner; DataGridView dataGridView = dataGridViewCell.DataGridView; if (dataGridView != null && dataGridViewCell.RowIndex == -1) { throw new InvalidOperationException(SR.DataGridView_InvalidOperationOnSharedCell); } if (!dataGridViewCell.ReadOnly && dataGridViewCell.OwningColumn != null && dataGridViewCell.OwningRow != null) { dataGridView.CurrentCell = dataGridViewCell; bool endEditMode = false; if (!dataGridView.IsCurrentCellInEditMode) { endEditMode = true; dataGridView.BeginEdit(false /*selectAll*/); } if (dataGridView.IsCurrentCellInEditMode) { if (dataGridViewCell.SwitchFormattedValue()) { dataGridViewCell.NotifyDataGridViewOfValueChange(); dataGridView.InvalidateCell(dataGridViewCell.ColumnIndex, dataGridViewCell.RowIndex); // notify MSAA clients that the default action changed if (Owner is DataGridViewCheckBoxCell checkBoxCell) { checkBoxCell.NotifyMASSClient(new Point(dataGridViewCell.ColumnIndex, dataGridViewCell.RowIndex)); } } if (endEditMode) { dataGridView.EndEdit(); } } } }
protected override void OnMouseMove(DataGridViewCellMouseEventArgs e) { if (DataGridView is null) { return; } if (LinkBoundsContainPoint(e.X, e.Y, e.RowIndex)) { if ((LinkState & LinkState.Hover) == 0) { LinkState |= LinkState.Hover; DataGridView.InvalidateCell(ColumnIndex, e.RowIndex); } if (s_dataGridViewCursor is null) { s_dataGridViewCursor = DataGridView.UserSetCursor; } if (DataGridView.Cursor != Cursors.Hand) { DataGridView.Cursor = Cursors.Hand; } } else { if ((LinkState & LinkState.Hover) != 0) { LinkState &= ~LinkState.Hover; DataGridView.Cursor = s_dataGridViewCursor; DataGridView.InvalidateCell(ColumnIndex, e.RowIndex); } } base.OnMouseMove(e); }
protected override void OnMouseMove(DataGridViewCellMouseEventArgs e) { if (DataGridView == null) { return; } bool oldMouseInContentBounds = mouseInContentBounds; mouseInContentBounds = GetContentBounds(e.RowIndex).Contains(e.X, e.Y); if (oldMouseInContentBounds != mouseInContentBounds) { if (DataGridView.ApplyVisualStylesToInnerCells || FlatStyle == FlatStyle.Flat || FlatStyle == FlatStyle.Popup) { DataGridView.InvalidateCell(ColumnIndex, e.RowIndex); } if (e.ColumnIndex == DataGridView.MouseDownCellAddress.X && e.RowIndex == DataGridView.MouseDownCellAddress.Y && Control.MouseButtons == MouseButtons.Left) { if ((ButtonState & ButtonState.Pushed) == 0 && mouseInContentBounds && DataGridView.CellMouseDownInContentBounds) { UpdateButtonState(ButtonState | ButtonState.Pushed, e.RowIndex); } else if ((ButtonState & ButtonState.Pushed) != 0 && !mouseInContentBounds) { UpdateButtonState(ButtonState & ~ButtonState.Pushed, e.RowIndex); } } } base.OnMouseMove(e); }
private void UpdateButtonState(ButtonState newButtonState, int rowIndex) { Debug.Assert(DataGridView != null); ButtonStatePrivate = newButtonState; DataGridView.InvalidateCell(ColumnIndex, rowIndex); }