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);
1070
ButtonState
bs;
1082
bs = (checkState == CheckState.Unchecked) ?
ButtonState
.Normal :
ButtonState
.Checked;
1090
bs =
ButtonState
.Checked;
1095
bs =
ButtonState
.Normal;
1101
bs =
ButtonState
.Normal; // Default rendering of the checkbox with wrong formatted value type.
1105
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
1107
bs |=
ButtonState
.Pushed;
1389
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
1697
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)
681
if (ButtonState !=
ButtonState
.Normal)
683
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)
1746
public static void DrawMixedCheckBox(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1749
public static void DrawMixedCheckBox(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1763
public static void DrawRadioButton(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1769
public static void DrawRadioButton(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1845
public static void DrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button,
ButtonState
state)
1855
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)
812
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
823
public void ControlPaint_DrawButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
835
public void ControlPaint_DrawButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
846
[InlineData(
ButtonState
.All)]
847
[InlineData(
ButtonState
.Normal)]
848
public void ControlPaint_DrawButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
855
[InlineData(0, 4,
ButtonState
.All)]
856
[InlineData(0, 4,
ButtonState
.Normal)]
857
[InlineData(3, 0,
ButtonState
.All)]
858
[InlineData(3, 0,
ButtonState
.Normal)]
859
[InlineData(0, 0,
ButtonState
.All)]
860
[InlineData(0, 0,
ButtonState
.Normal)]
861
public void ControlPaint_DrawButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
870
[InlineData(
ButtonState
.All)]
871
[InlineData(
ButtonState
.Normal)]
872
public void ControlPaint_DrawButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
881
[InlineData(
ButtonState
.All)]
882
[InlineData(
ButtonState
.Normal)]
883
public void ControlPaint_DrawButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
895
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
907
public void ControlPaint_DrawCaptionButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle, CaptionButton button,
ButtonState
state)
919
public void ControlPaint_DrawCaptionButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle, CaptionButton button,
ButtonState
state)
930
[InlineData(
ButtonState
.All)]
931
[InlineData(
ButtonState
.Normal)]
932
public void ControlPaint_DrawCaptionButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
939
[InlineData(0, 4,
ButtonState
.All)]
940
[InlineData(0, 4,
ButtonState
.Normal)]
941
[InlineData(3, 0,
ButtonState
.All)]
942
[InlineData(3, 0,
ButtonState
.Normal)]
943
[InlineData(0, 0,
ButtonState
.All)]
944
public void ControlPaint_DrawCaptionButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
953
[InlineData(
ButtonState
.All)]
954
[InlineData(
ButtonState
.Normal)]
955
public void ControlPaint_DrawCaptionButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
964
[InlineData(
ButtonState
.All)]
965
[InlineData(
ButtonState
.Normal)]
966
public void ControlPaint_DrawCaptionButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
976
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
987
public void ControlPaint_DrawCheckBox_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
999
public void ControlPaint_DrawCheckBox_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
1010
[InlineData(
ButtonState
.All)]
1011
[InlineData(
ButtonState
.Normal)]
1012
public void ControlPaint_DrawCheckBox_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1019
[InlineData(0, 4,
ButtonState
.All)]
1020
[InlineData(0, 4,
ButtonState
.Normal)]
1021
[InlineData(3, 0,
ButtonState
.All)]
1022
[InlineData(3, 0,
ButtonState
.Normal)]
1023
[InlineData(0, 0,
ButtonState
.All)]
1024
[InlineData(0, 0,
ButtonState
.Normal)]
1025
public void ControlPaint_DrawCheckBox_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1034
[InlineData(
ButtonState
.All, "rectangle")]
1035
[InlineData(
ButtonState
.Normal, "width")]
1036
public void ControlPaint_DrawCheckBox_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state, string expectedParamName)
1045
[InlineData(
ButtonState
.All, "rectangle")]
1046
[InlineData(
ButtonState
.Normal, "height")]
1047
public void ControlPaint_DrawCheckBox_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state, string expectedParamName)
1057
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
1068
public void ControlPaint_DrawComboButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
1080
public void ControlPaint_DrawComboButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
1091
[InlineData(
ButtonState
.All)]
1092
[InlineData(
ButtonState
.Normal)]
1093
public void ControlPaint_DrawComboButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1100
[InlineData(0, 4,
ButtonState
.All)]
1101
[InlineData(0, 4,
ButtonState
.Normal)]
1102
[InlineData(3, 0,
ButtonState
.All)]
1103
[InlineData(3, 0,
ButtonState
.Normal)]
1104
[InlineData(0, 0,
ButtonState
.All)]
1105
public void ControlPaint_DrawComboButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1114
[InlineData(
ButtonState
.All)]
1115
[InlineData(
ButtonState
.Normal)]
1116
public void ControlPaint_DrawComboButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1125
[InlineData(
ButtonState
.All)]
1126
[InlineData(
ButtonState
.Normal)]
1127
public void ControlPaint_DrawComboButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1518
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
1529
public void ControlPaint_DrawMixedCheckBox_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
1541
public void ControlPaint_DrawMixedCheckBox_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
1552
[InlineData(
ButtonState
.All)]
1553
[InlineData(
ButtonState
.Normal)]
1554
public void ControlPaint_DrawMixedCheckBox_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1561
[InlineData(0, 4,
ButtonState
.All)]
1562
[InlineData(0, 4,
ButtonState
.Normal)]
1563
[InlineData(3, 0,
ButtonState
.All)]
1564
[InlineData(3, 0,
ButtonState
.Normal)]
1565
[InlineData(0, 0,
ButtonState
.All)]
1566
public void ControlPaint_DrawMixedCheckBox_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1575
[InlineData(
ButtonState
.All)]
1576
[InlineData(
ButtonState
.Normal)]
1577
public void ControlPaint_DrawMixedCheckBox_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1586
[InlineData(
ButtonState
.All)]
1587
[InlineData(
ButtonState
.Normal)]
1588
public void ControlPaint_DrawMixedCheckBox_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1598
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
1609
public void ControlPaint_DrawRadioButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle,
ButtonState
state)
1621
public void ControlPaint_DrawRadioButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle,
ButtonState
state)
1632
[InlineData(
ButtonState
.All)]
1633
[InlineData(
ButtonState
.Normal)]
1634
public void ControlPaint_DrawRadioButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1641
[InlineData(0, 4,
ButtonState
.All)]
1642
[InlineData(0, 4,
ButtonState
.Normal)]
1643
[InlineData(3, 0,
ButtonState
.All)]
1644
[InlineData(3, 0,
ButtonState
.Normal)]
1645
[InlineData(0, 0,
ButtonState
.All)]
1646
public void ControlPaint_DrawRadioButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1655
[InlineData(
ButtonState
.All)]
1656
[InlineData(
ButtonState
.Normal)]
1657
public void ControlPaint_DrawRadioButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1666
[InlineData(
ButtonState
.All)]
1667
[InlineData(
ButtonState
.Normal)]
1668
public void ControlPaint_DrawRadioButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1735
foreach (
ButtonState
state in Enum.GetValues(typeof(
ButtonState
)))
1747
public void ControlPaint_DrawScrollButton_InvokeGraphicsRectangleButtonState_Success(Rectangle rectangle, ScrollButton button,
ButtonState
state)
1759
public void ControlPaint_DrawScrollButton_InvokeGraphicsIntIntIntIntButtonState_Success(Rectangle rectangle, ScrollButton button,
ButtonState
state)
1770
[InlineData(
ButtonState
.All)]
1771
[InlineData(
ButtonState
.Normal)]
1772
public void ControlPaint_DrawScrollButton_NullGraphics_ThrowsArgumentNullException(
ButtonState
state)
1779
[InlineData(0, 4,
ButtonState
.All)]
1780
[InlineData(0, 4,
ButtonState
.Normal)]
1781
[InlineData(3, 0,
ButtonState
.All)]
1782
[InlineData(3, 0,
ButtonState
.Normal)]
1783
[InlineData(0, 0,
ButtonState
.All)]
1784
public void ControlPaint_DrawScrollButton_EmptyRectangle_ThrowsArgumentException(int width, int height,
ButtonState
state)
1793
[InlineData(
ButtonState
.All)]
1794
[InlineData(
ButtonState
.Normal)]
1795
public void ControlPaint_DrawScrollButton_NegativeWidth_ThrowsArgumentOutOfRangeException(
ButtonState
state)
1804
[InlineData(
ButtonState
.All)]
1805
[InlineData(
ButtonState
.Normal)]
1806
public void ControlPaint_DrawScrollButton_NegativeHeight_ThrowsArgumentOutOfRangeException(
ButtonState
state)
System\Windows\Forms\DataGridViewHeaderCellTests.cs (72)
18
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3834
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3888
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3910
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3918
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3930
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3956
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3969
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
3995
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4001
ButtonState
expected = VisualStyleRenderer.IsSupported ?
ButtonState
.Pushed :
ButtonState
.Normal;
4006
yield return new object[] { false, -2,
ButtonState
.Normal };
4007
yield return new object[] { false, -1,
ButtonState
.Normal };
4008
yield return new object[] { false, 0,
ButtonState
.Normal };
4009
yield return new object[] { false, 1,
ButtonState
.Normal };
4014
public void DataGridViewHeaderCell_MouseLeaveUnsharesRow_InvokeWithDataGridViewMouseDown_ReturnsExpected(bool enableHeadersVisualStylesParam, int rowIndexParam,
ButtonState
expectedButtonStateParam)
4021
ButtonState
expectedButtonState = (
ButtonState
)Enum.Parse(typeof(
ButtonState
), expectedButtonStateString);
4049
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4078
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4089
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4098
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4130
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4137
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, -1, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4138
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 };
4139
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, -1, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4140
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, -1, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4141
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 };
4142
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, -1, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4143
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, 0, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4144
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 };
4145
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(-1, 0, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4146
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 0, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4147
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 };
4148
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 0, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4149
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(1, 0, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4150
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 };
4151
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4152
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0)),
ButtonState
.Normal };
4153
yield return new object[] { enableHeadersVisualStyles, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Middle, 0, 0, 0, 0)),
ButtonState
.Normal };
4156
yield return new object[] { false, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)),
ButtonState
.Normal };
4169
ButtonState
expectedButtonState = (
ButtonState
)testData[2];
4212
Assert.Equal(VisualStyleRenderer.IsSupported ?
ButtonState
.Pushed :
ButtonState
.Normal, cell.ButtonState);
4228
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4240
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4270
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4308
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4338
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4397
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4427
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4437
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4485
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4517
ButtonState
expectedButtonState1 = enableHeadersVisualStyles && VisualStyleRenderer.IsSupported ?
ButtonState
.Pushed :
ButtonState
.Normal;
4518
ButtonState
expectedButtonState2 = enableHeadersVisualStyles && VisualStyleRenderer.IsSupported ?
ButtonState
.Normal : expectedButtonState1;
4538
yield return new object[] { false, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)),
ButtonState
.Normal };
4551
ButtonState
expectedButtonState = (
ButtonState
)testData[2];
4595
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4611
Assert.Equal(
ButtonState
.Normal, cell.ButtonState);
4685
public new
ButtonState
ButtonState => base.ButtonState;