protected override void OnContentClick (DataGridViewCellEventArgs e)
{
+ if (ReadOnly)
+ return;
+
if (!IsInEditMode)
DataGridView.BeginEdit (false);
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) {
+ if (!ReadOnly && (e.KeyData & Keys.Space) == Keys.Space) {
check_state = PushButtonState.Pressed;
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 ((e.KeyData & Keys.Space) == Keys.Space) {
+ if (!ReadOnly && (e.KeyData & Keys.Space) == Keys.Space) {
check_state = PushButtonState.Normal;
DataGridView.InvalidateCell (this);
}
protected override void OnLeave (int rowIndex, bool throughMouseClick)
{
- if (check_state != PushButtonState.Normal) {
+ if (!ReadOnly && check_state != PushButtonState.Normal) {
check_state = PushButtonState.Normal;
DataGridView.InvalidateCell (this);
}
protected override void OnMouseDown (DataGridViewCellMouseEventArgs e)
{
// if activated by depresing the left mouse button, this method updates the cell's user interface
- if ((e.Button & MouseButtons.Left) == MouseButtons.Left) {
+ if (!ReadOnly && (e.Button & MouseButtons.Left) == MouseButtons.Left) {
check_state = PushButtonState.Pressed;
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 (check_state != PushButtonState.Normal) {
+ if (!ReadOnly && check_state != PushButtonState.Normal) {
check_state = PushButtonState.Normal;
DataGridView.InvalidateCell (this);
}
protected override void OnMouseMove (DataGridViewCellMouseEventArgs e)
{
- if (check_state != PushButtonState.Normal && check_state != PushButtonState.Hot) {
+ if (!ReadOnly && check_state != PushButtonState.Normal && check_state != PushButtonState.Hot) {
check_state = PushButtonState.Hot;
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 ((e.Button & MouseButtons.Left) == MouseButtons.Left) {
+ if (!ReadOnly && (e.Button & MouseButtons.Left) == MouseButtons.Left) {
check_state = PushButtonState.Normal;
DataGridView.InvalidateCell (this);
}