From ace9a03b742ecbcc80ac5c4ce1aff902978a680f Mon Sep 17 00:00:00 2001 From: Ivan Zlatev Date: Fri, 9 Jan 2009 19:46:31 +0000 Subject: [PATCH 1/1] 2009-01-09 Ivan N. Zlatev * DataGridViewCheckBoxCell.cs: Respect the ReadOnly state of the Cell. svn path=/trunk/mcs/; revision=122933 --- .../System.Windows.Forms/ChangeLog | 4 ++++ .../DataGridViewCheckBoxCell.cs | 17 ++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index 0d3f525648f..2e09c2583f1 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,7 @@ +2009-01-09 Ivan N. Zlatev + + * DataGridViewCheckBoxCell.cs: Respect the ReadOnly state of the Cell. + 2009-01-09 Ivan N. Zlatev * DataGridView.cs: Track the Position in the CurrencyManager. diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxCell.cs index 81a5d2084cf..ee888915b02 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxCell.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxCell.cs @@ -287,6 +287,9 @@ namespace System.Windows.Forms { protected override void OnContentClick (DataGridViewCellEventArgs e) { + if (ReadOnly) + return; + if (!IsInEditMode) DataGridView.BeginEdit (false); @@ -316,7 +319,7 @@ namespace System.Windows.Forms { 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); } @@ -325,7 +328,7 @@ namespace System.Windows.Forms { 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); } @@ -333,7 +336,7 @@ namespace System.Windows.Forms { 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); } @@ -342,7 +345,7 @@ namespace System.Windows.Forms { 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); } @@ -351,7 +354,7 @@ namespace System.Windows.Forms { 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); } @@ -359,7 +362,7 @@ namespace System.Windows.Forms { 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); } @@ -368,7 +371,7 @@ namespace System.Windows.Forms { 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); } -- 2.25.1