397 references to ButtonState
System.Windows.Forms (187)
System\Windows\Forms\Controls\Buttons\ButtonInternal\CheckBoxBaseAdapter.cs (7)
232
protected
ButtonState
GetState()
234
ButtonState
style = 0;
238
style |=
ButtonState
.Normal;
242
style |=
ButtonState
.Checked;
247
style |=
ButtonState
.Inactive;
252
style |=
ButtonState
.Pushed;
260
ButtonState
style = GetState();
System\Windows\Forms\Controls\Buttons\ButtonInternal\RadioButtonBaseAdapter.cs (7)
168
protected
ButtonState
GetState()
170
ButtonState
style = default;
174
style |=
ButtonState
.Checked;
178
style |=
ButtonState
.Normal;
183
style |=
ButtonState
.Inactive;
188
style |=
ButtonState
.Pushed;
202
ButtonState
style = GetState();
System\Windows\Forms\Controls\Buttons\ButtonRenderer.cs (4)
281
internal static
ButtonState
ConvertToButtonState(PushButtonState state) => state switch
283
PushButtonState.Pressed =>
ButtonState
.Pushed,
284
PushButtonState.Disabled =>
ButtonState
.Inactive,
285
_ =>
ButtonState
.Normal,
System\Windows\Forms\Controls\Buttons\CheckBoxRenderer.cs (29)
255
internal static
ButtonState
ConvertToButtonState(CheckBoxState state) => state switch
257
CheckBoxState.CheckedNormal or CheckBoxState.CheckedHot =>
ButtonState
.Checked,
258
CheckBoxState.CheckedPressed => (
ButtonState
.Checked |
ButtonState
.Pushed),
259
CheckBoxState.CheckedDisabled => (
ButtonState
.Checked |
ButtonState
.Inactive),
260
CheckBoxState.UncheckedPressed =>
ButtonState
.Pushed,
261
CheckBoxState.UncheckedDisabled =>
ButtonState
.Inactive,
263
CheckBoxState.MixedNormal or CheckBoxState.MixedHot =>
ButtonState
.Checked,
264
CheckBoxState.MixedPressed => (
ButtonState
.Checked |
ButtonState
.Pushed),
265
CheckBoxState.MixedDisabled => (
ButtonState
.Checked |
ButtonState
.Inactive),
266
_ =>
ButtonState
.Normal,
269
internal static CheckBoxState ConvertFromButtonState(
ButtonState
state, bool isMixed, bool isHot)
273
if ((state &
ButtonState
.Pushed) ==
ButtonState
.Pushed)
277
else if ((state &
ButtonState
.Inactive) ==
ButtonState
.Inactive)
288
else if ((state &
ButtonState
.Checked) ==
ButtonState
.Checked)
290
if ((state &
ButtonState
.Pushed) ==
ButtonState
.Pushed)
294
else if ((state &
ButtonState
.Inactive) ==
ButtonState
.Inactive)
308
if ((state &
ButtonState
.Pushed) ==
ButtonState
.Pushed)
312
else if ((state &
ButtonState
.Inactive) ==
ButtonState
.Inactive)
System\Windows\Forms\Controls\Buttons\RadioButtonRenderer.cs (20)
268
internal static
ButtonState
ConvertToButtonState(RadioButtonState state) => state switch
270
RadioButtonState.CheckedNormal or RadioButtonState.CheckedHot =>
ButtonState
.Checked,
271
RadioButtonState.CheckedPressed =>
ButtonState
.Checked |
ButtonState
.Pushed,
272
RadioButtonState.CheckedDisabled =>
ButtonState
.Checked |
ButtonState
.Inactive,
273
RadioButtonState.UncheckedPressed =>
ButtonState
.Pushed,
274
RadioButtonState.UncheckedDisabled =>
ButtonState
.Inactive,
275
_ =>
ButtonState
.Normal,
278
internal static RadioButtonState ConvertFromButtonState(
ButtonState
state, bool isHot)
280
if ((state &
ButtonState
.Checked) ==
ButtonState
.Checked)
282
if ((state &
ButtonState
.Pushed) ==
ButtonState
.Pushed)
286
else if ((state &
ButtonState
.Inactive) ==
ButtonState
.Inactive)
300
if ((state &
ButtonState
.Pushed) ==
ButtonState
.Pushed)
304
else if ((state &
ButtonState
.Inactive) ==
ButtonState
.Inactive)
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (34)
38
private
ButtonState
ButtonState
40
get => Properties.GetValueOrDefault(s_propButtonCellState,
ButtonState
.Normal);
45
Debug.Assert((value & ~(
ButtonState
.Normal |
ButtonState
.Pushed |
ButtonState
.Checked)) == 0);
48
Properties.AddOrRemoveValue(s_propButtonCellState, value, defaultValue:
ButtonState
.Normal);
452
ButtonState.HasFlag(
ButtonState
.Pushed);
466
UpdateButtonState(ButtonState |
ButtonState
.Checked, rowIndex);
480
UpdateButtonState(ButtonState & ~
ButtonState
.Checked, rowIndex);
503
if (ButtonState !=
ButtonState
.Normal)
506
UpdateButtonState(
ButtonState
.Normal, rowIndex);
520
UpdateButtonState(ButtonState |
ButtonState
.Pushed, e.RowIndex);
542
if (ButtonState.HasFlag(
ButtonState
.Pushed) &&
546
UpdateButtonState(ButtonState & ~
ButtonState
.Pushed, rowIndex);
570
if (!ButtonState.HasFlag(
ButtonState
.Pushed) &&
574
UpdateButtonState(ButtonState |
ButtonState
.Pushed, e.RowIndex);
576
else if (ButtonState.HasFlag(
ButtonState
.Pushed) && !s_mouseInContentBounds)
578
UpdateButtonState(ButtonState & ~
ButtonState
.Pushed, e.RowIndex);
595
UpdateButtonState(ButtonState & ~
ButtonState
.Pushed, e.RowIndex);
724
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
753
(ButtonState ==
ButtonState
.Normal) ? ButtonBorderStyle.Outset : ButtonBorderStyle.Inset);
771
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
802
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
894
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0 ||
929
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0 ||
934
bool paintUp = (ButtonState ==
ButtonState
.Normal);
966
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0 &&
1013
private void UpdateButtonState(
ButtonState
newButtonState, int rowIndex)
System\Windows\Forms\Controls\DataGridView\DataGridViewCheckBoxCell.cs (31)
180
private
ButtonState
ButtonState
182
get => Properties.GetValueOrDefault(s_propButtonCellState,
ButtonState
.Normal);
187
Debug.Assert((value & ~(
ButtonState
.Normal |
ButtonState
.Pushed |
ButtonState
.Checked)) == 0);
190
Properties.AddOrRemoveValue(s_propButtonCellState, value, defaultValue:
ButtonState
.Normal);
770
protected override bool MouseLeaveUnsharesRow(int rowIndex) => ButtonState.HasFlag(
ButtonState
.Pushed);
814
UpdateButtonState(ButtonState |
ButtonState
.Checked, rowIndex);
828
UpdateButtonState(ButtonState & ~
ButtonState
.Checked, rowIndex);
853
if (ButtonState !=
ButtonState
.Normal)
856
UpdateButtonState(
ButtonState
.Normal, rowIndex);
870
UpdateButtonState(ButtonState |
ButtonState
.Pushed, e.RowIndex);
892
if (ButtonState.HasFlag(
ButtonState
.Pushed) &&
896
UpdateButtonState(ButtonState & ~
ButtonState
.Pushed, rowIndex);
920
if (!ButtonState.HasFlag(
ButtonState
.Pushed) &&
924
UpdateButtonState(ButtonState |
ButtonState
.Pushed, e.RowIndex);
926
else if (ButtonState.HasFlag(
ButtonState
.Pushed) && !s_mouseInContentBounds)
928
UpdateButtonState(ButtonState & ~
ButtonState
.Pushed, e.RowIndex);
945
UpdateButtonState(ButtonState & ~
ButtonState
.Pushed, e.RowIndex);
1078
ButtonState
bs;
1090
bs = (checkState == CheckState.Unchecked) ?
ButtonState
.Normal :
ButtonState
.Checked;
1098
bs =
ButtonState
.Checked;
1103
bs =
ButtonState
.Normal;
1109
bs =
ButtonState
.Normal; // Default rendering of the checkbox with wrong formatted value type.
1113
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
1115
bs |=
ButtonState
.Pushed;
1397
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
1705
private void UpdateButtonState(
ButtonState
newButtonState, int rowIndex)
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (2)
803
if (ButtonState !=
ButtonState
.Normal)
805
Debug.Assert(ButtonState ==
ButtonState
.Pushed);
System\Windows\Forms\Controls\DataGridView\DataGridViewHeaderCell.cs (12)
29
protected
ButtonState
ButtonState
31
get => Properties.GetValueOrDefault(s_propButtonState,
ButtonState
.Normal);
32
private set => Properties.AddOrRemoveValue(s_propButtonState, value, defaultValue:
ButtonState
.Normal);
438
DataGridView is not null && ButtonState !=
ButtonState
.Normal && DataGridView.ApplyVisualStylesToHeaderCells;
454
UpdateButtonState(
ButtonState
.Pushed, e.RowIndex);
469
ButtonState ==
ButtonState
.Normal &&
473
UpdateButtonState(
ButtonState
.Pushed, rowIndex);
489
if (ButtonState !=
ButtonState
.Normal)
491
Debug.Assert(ButtonState ==
ButtonState
.Pushed);
494
UpdateButtonState(
ButtonState
.Normal, rowIndex);
510
UpdateButtonState(
ButtonState
.Normal, e.RowIndex);
561
private void UpdateButtonState(
ButtonState
newButtonState, int rowIndex)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (2)
685
if (ButtonState !=
ButtonState
.Normal)
687
Debug.Assert(ButtonState ==
ButtonState
.Pushed);
System\Windows\Forms\Controls\DataGridView\DataGridViewTopLeftHeaderCell.cs (2)
248
if (ButtonState !=
ButtonState
.Normal)
250
Debug.Assert(ButtonState ==
ButtonState
.Pushed);
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (6)
501
ButtonState
state =
ButtonState
.Normal;
504
state |=
ButtonState
.Flat;
512
state |=
ButtonState
.Checked;
515
state |=
ButtonState
.Checked |
ButtonState
.Inactive;
System\Windows\Forms\Controls\ToolStrips\ToolStripMenuItem.cs (1)
711
ControlPaint.DrawCaptionButton(g, new Rectangle(Point.Empty, image.Size), (CaptionButton)buttonToUse,
ButtonState
.Flat);
System\Windows\Forms\Controls\UpDown\UpDownBase.UpDownButtons.cs (6)
309
_pushed == ButtonID.Up ?
ButtonState
.Pushed : (Enabled ?
ButtonState
.Normal :
ButtonState
.Inactive));
315
_pushed == ButtonID.Down ?
ButtonState
.Pushed : (Enabled ?
ButtonState
.Normal :
ButtonState
.Inactive));
System\Windows\Forms\Rendering\ControlPaint.cs (24)
1179
public static void DrawButton(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1185
public static void DrawButton(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1203
ButtonState
state) => DrawCaptionButton(
1216
ButtonState
state) => DrawFrameControl(
1227
public static void DrawCheckBox(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1233
public static void DrawCheckBox(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1236
if ((state &
ButtonState
.Flat) ==
ButtonState
.Flat)
1255
public static void DrawComboButton(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1261
public static void DrawComboButton(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1317
private static void DrawFlatCheckBox(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1323
Brush background = ((state &
ButtonState
.Inactive) ==
ButtonState
.Inactive)
1326
Color foreground = ((state &
ButtonState
.Inactive) ==
ButtonState
.Inactive)
1342
ButtonState
state)
1358
if ((state &
ButtonState
.Checked) ==
ButtonState
.Checked)
1745
public static void DrawMixedCheckBox(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1748
public static void DrawMixedCheckBox(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1762
public static void DrawRadioButton(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1768
public static void DrawRadioButton(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1844
public static void DrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button,
ButtonState
state)
1854
ButtonState
state) => DrawFrameControl(
System.Windows.Forms.Design (3)
System\ComponentModel\Design\CollectionEditor.CollectionEditorCollectionForm.cs (1)
574
ControlPaint.DrawButton(g, button,
ButtonState
.Normal);
System\Windows\Forms\Design\AnchorEditor.AnchorUI.cs (1)
201
ControlPaint.DrawButton(e.Graphics, rc,
ButtonState
.Normal);
System\Windows\Forms\Design\DockEditor.DockUI.cs (1)
302
ControlPaint.DrawButton(e.Graphics, rc,
ButtonState
.Pushed);
System.Windows.Forms.Tests (207)
System\Windows\Forms\ControlPaintTests.cs (135)
814
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
825
public void ControlPaint_DrawButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
837
public void ControlPaint_DrawButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
848
[InlineData(
ButtonState
.All)]
849
[InlineData(
ButtonState
.Normal)]
850
public void ControlPaint_DrawButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
857
[InlineData(0, 4,
ButtonState
.All)]
858
[InlineData(0, 4,
ButtonState
.Normal)]
859
[InlineData(3, 0,
ButtonState
.All)]
860
[InlineData(3, 0,
ButtonState
.Normal)]
861
[InlineData(0, 0,
ButtonState
.All)]
862
[InlineData(0, 0,
ButtonState
.Normal)]
863
public void ControlPaint_DrawButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
872
[InlineData(
ButtonState
.All)]
873
[InlineData(
ButtonState
.Normal)]
874
public void ControlPaint_DrawButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
883
[InlineData(
ButtonState
.All)]
884
[InlineData(
ButtonState
.Normal)]
885
public void ControlPaint_DrawButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
897
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
909
public void ControlPaint_DrawCaptionButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle, CaptionButton button,
ButtonState
state)
921
public void ControlPaint_DrawCaptionButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle, CaptionButton button,
ButtonState
state)
932
[InlineData(
ButtonState
.All)]
933
[InlineData(
ButtonState
.Normal)]
934
public void ControlPaint_DrawCaptionButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
941
[InlineData(0, 4,
ButtonState
.All)]
942
[InlineData(0, 4,
ButtonState
.Normal)]
943
[InlineData(3, 0,
ButtonState
.All)]
944
[InlineData(3, 0,
ButtonState
.Normal)]
945
[InlineData(0, 0,
ButtonState
.All)]
946
public void ControlPaint_DrawCaptionButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
955
[InlineData(
ButtonState
.All)]
956
[InlineData(
ButtonState
.Normal)]
957
public void ControlPaint_DrawCaptionButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
966
[InlineData(
ButtonState
.All)]
967
[InlineData(
ButtonState
.Normal)]
968
public void ControlPaint_DrawCaptionButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
978
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
989
public void ControlPaint_DrawCheckBox_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
1001
public void ControlPaint_DrawCheckBox_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
1012
[InlineData(
ButtonState
.All)]
1013
[InlineData(
ButtonState
.Normal)]
1014
public void ControlPaint_DrawCheckBox_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1021
[InlineData(0, 4,
ButtonState
.All)]
1022
[InlineData(0, 4,
ButtonState
.Normal)]
1023
[InlineData(3, 0,
ButtonState
.All)]
1024
[InlineData(3, 0,
ButtonState
.Normal)]
1025
[InlineData(0, 0,
ButtonState
.All)]
1026
[InlineData(0, 0,
ButtonState
.Normal)]
1027
public void ControlPaint_DrawCheckBox_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1036
[InlineData(
ButtonState
.All, "rectangle")]
1037
[InlineData(
ButtonState
.Normal, "width")]
1038
public void ControlPaint_DrawCheckBox_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state, string expectedParamName)
1047
[InlineData(
ButtonState
.All, "rectangle")]
1048
[InlineData(
ButtonState
.Normal, "height")]
1049
public void ControlPaint_DrawCheckBox_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state, string expectedParamName)
1059
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
1070
public void ControlPaint_DrawComboButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
1082
public void ControlPaint_DrawComboButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
1093
[InlineData(
ButtonState
.All)]
1094
[InlineData(
ButtonState
.Normal)]
1095
public void ControlPaint_DrawComboButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1102
[InlineData(0, 4,
ButtonState
.All)]
1103
[InlineData(0, 4,
ButtonState
.Normal)]
1104
[InlineData(3, 0,
ButtonState
.All)]
1105
[InlineData(3, 0,
ButtonState
.Normal)]
1106
[InlineData(0, 0,
ButtonState
.All)]
1107
public void ControlPaint_DrawComboButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1116
[InlineData(
ButtonState
.All)]
1117
[InlineData(
ButtonState
.Normal)]
1118
public void ControlPaint_DrawComboButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1127
[InlineData(
ButtonState
.All)]
1128
[InlineData(
ButtonState
.Normal)]
1129
public void ControlPaint_DrawComboButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1520
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
1531
public void ControlPaint_DrawMixedCheckBox_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
1543
public void ControlPaint_DrawMixedCheckBox_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
1554
[InlineData(
ButtonState
.All)]
1555
[InlineData(
ButtonState
.Normal)]
1556
public void ControlPaint_DrawMixedCheckBox_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1563
[InlineData(0, 4,
ButtonState
.All)]
1564
[InlineData(0, 4,
ButtonState
.Normal)]
1565
[InlineData(3, 0,
ButtonState
.All)]
1566
[InlineData(3, 0,
ButtonState
.Normal)]
1567
[InlineData(0, 0,
ButtonState
.All)]
1568
public void ControlPaint_DrawMixedCheckBox_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1577
[InlineData(
ButtonState
.All)]
1578
[InlineData(
ButtonState
.Normal)]
1579
public void ControlPaint_DrawMixedCheckBox_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1588
[InlineData(
ButtonState
.All)]
1589
[InlineData(
ButtonState
.Normal)]
1590
public void ControlPaint_DrawMixedCheckBox_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1600
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
1611
public void ControlPaint_DrawRadioButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
1623
public void ControlPaint_DrawRadioButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
1634
[InlineData(
ButtonState
.All)]
1635
[InlineData(
ButtonState
.Normal)]
1636
public void ControlPaint_DrawRadioButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1643
[InlineData(0, 4,
ButtonState
.All)]
1644
[InlineData(0, 4,
ButtonState
.Normal)]
1645
[InlineData(3, 0,
ButtonState
.All)]
1646
[InlineData(3, 0,
ButtonState
.Normal)]
1647
[InlineData(0, 0,
ButtonState
.All)]
1648
public void ControlPaint_DrawRadioButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1657
[InlineData(
ButtonState
.All)]
1658
[InlineData(
ButtonState
.Normal)]
1659
public void ControlPaint_DrawRadioButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1668
[InlineData(
ButtonState
.All)]
1669
[InlineData(
ButtonState
.Normal)]
1670
public void ControlPaint_DrawRadioButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1737
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
1749
public void ControlPaint_DrawScrollButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle, ScrollButton button,
ButtonState
state)
1761
public void ControlPaint_DrawScrollButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle, ScrollButton button,
ButtonState
state)
1772
[InlineData(
ButtonState
.All)]
1773
[InlineData(
ButtonState
.Normal)]
1774
public void ControlPaint_DrawScrollButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1781
[InlineData(0, 4,
ButtonState
.All)]
1782
[InlineData(0, 4,
ButtonState
.Normal)]
1783
[InlineData(3, 0,
ButtonState
.All)]
1784
[InlineData(3, 0,
ButtonState
.Normal)]
1785
[InlineData(0, 0,
ButtonState
.All)]
1786
public void ControlPaint_DrawScrollButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1795
[InlineData(
ButtonState
.All)]
1796
[InlineData(
ButtonState
.Normal)]
1797
public void ControlPaint_DrawScrollButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1806
[InlineData(
ButtonState
.All)]
1807
[InlineData(
ButtonState
.Normal)]
1808
public void ControlPaint_DrawScrollButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
System\Windows\Forms\DataGridViewHeaderCellTests.cs (72)
20
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3836
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3890
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3912
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3920
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3932
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3958
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3971
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3997
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4003
ButtonState
expected = VisualStyleRenderer.IsSupported ?
ButtonState
.Pushed :
ButtonState
.Normal;
4008
yield return new object[] { false, -2,
ButtonState
.Normal };
4009
yield return new object[] { false, -1,
ButtonState
.Normal };
4010
yield return new object[] { false, 0,
ButtonState
.Normal };
4011
yield return new object[] { false, 1,
ButtonState
.Normal };
4016
public void DataGridViewHeaderCell_MouseLeaveUnsharesRow_InvokeWithDataGridViewMouseDown_ReturnsExpected(bool enableHeadersVisualStylesParam, int rowIndexParam,
ButtonState
expectedButtonStateParam)
4023
ButtonState
expectedButtonState = (
ButtonState
)Enum.Parse(typeof(
ButtonState
), expectedButtonStateString);
4051
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4080
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4091
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4100
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4132
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4139
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, -1, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4140
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, -1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)), VisualStyleRenderer.IsSupported && enableHeadersVisualStyles ?
ButtonState
.Pushed :
ButtonState
.Normal };
4141
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, -1, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4142
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, -1, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4143
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, -1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)), VisualStyleRenderer.IsSupported && enableHeadersVisualStyles ?
ButtonState
.Pushed :
ButtonState
.Normal };
4144
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, -1, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4145
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, 0, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4146
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, 0, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)), VisualStyleRenderer.IsSupported && enableHeadersVisualStyles ?
ButtonState
.Pushed :
ButtonState
.Normal };
4147
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, 0, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4148
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 0, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4149
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 0, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)), VisualStyleRenderer.IsSupported && enableHeadersVisualStyles ?
ButtonState
.Pushed :
ButtonState
.Normal };
4150
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 0, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4151
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(1, 0, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4152
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(1, 0, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)), VisualStyleRenderer.IsSupported && enableHeadersVisualStyles ?
ButtonState
.Pushed :
ButtonState
.Normal };
4153
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4154
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4155
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4158
yield return new object[] { false, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)),
ButtonState
.Normal };
4171
ButtonState
expectedButtonState = (
ButtonState
)testData[2];
4214
Assert.Equal(VisualStyleRenderer.IsSupported ?
ButtonState
.Pushed :
ButtonState
.Normal, cell.ButtonState);
4230
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4242
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4272
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4310
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4340
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4399
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4429
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4439
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4487
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4519
ButtonState
expectedButtonState1 = enableHeadersVisualStyles && VisualStyleRenderer.IsSupported ?
ButtonState
.Pushed :
ButtonState
.Normal;
4520
ButtonState
expectedButtonState2 = enableHeadersVisualStyles && VisualStyleRenderer.IsSupported ?
ButtonState
.Normal : expectedButtonState1;
4540
yield return new object[] { false, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)),
ButtonState
.Normal };
4553
ButtonState
expectedButtonState = (
ButtonState
)testData[2];
4597
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4613
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4687
public new
ButtonState
ButtonState => base.ButtonState;