186 references to ButtonState
System.Windows.Forms (183)
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);
449
ButtonState.HasFlag(
ButtonState
.Pushed);
463
UpdateButtonState(ButtonState |
ButtonState
.Checked, rowIndex);
477
UpdateButtonState(ButtonState & ~
ButtonState
.Checked, rowIndex);
500
if (ButtonState !=
ButtonState
.Normal)
503
UpdateButtonState(
ButtonState
.Normal, rowIndex);
517
UpdateButtonState(ButtonState |
ButtonState
.Pushed, e.RowIndex);
539
if (ButtonState.HasFlag(
ButtonState
.Pushed) &&
543
UpdateButtonState(ButtonState & ~
ButtonState
.Pushed, rowIndex);
567
if (!ButtonState.HasFlag(
ButtonState
.Pushed) &&
571
UpdateButtonState(ButtonState |
ButtonState
.Pushed, e.RowIndex);
573
else if (ButtonState.HasFlag(
ButtonState
.Pushed) && !s_mouseInContentBounds)
575
UpdateButtonState(ButtonState & ~
ButtonState
.Pushed, e.RowIndex);
592
UpdateButtonState(ButtonState & ~
ButtonState
.Pushed, e.RowIndex);
721
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
750
(ButtonState ==
ButtonState
.Normal) ? ButtonBorderStyle.Outset : ButtonBorderStyle.Inset);
768
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
799
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
891
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0 ||
926
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0 ||
931
bool paintUp = (ButtonState ==
ButtonState
.Normal);
963
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0 &&
1010
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;
1394
if ((ButtonState & (
ButtonState
.Pushed |
ButtonState
.Checked)) != 0)
1702
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\Rendering\ControlPaint.cs (26)
1211
public static void DrawButton(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1217
public static void DrawButton(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1235
ButtonState
state) => DrawCaptionButton(
1248
ButtonState
state) => DrawFrameControl(
1259
public static void DrawCheckBox(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1265
public static void DrawCheckBox(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1268
if ((state &
ButtonState
.Flat) ==
ButtonState
.Flat)
1287
public static void DrawComboButton(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1293
public static void DrawComboButton(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1349
private static void DrawFlatCheckBox(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1355
Brush background = ((state &
ButtonState
.Inactive) ==
ButtonState
.Inactive)
1358
Color foreground = ((state &
ButtonState
.Inactive) ==
ButtonState
.Inactive)
1374
ButtonState
state)
1390
if ((state &
ButtonState
.Checked) ==
ButtonState
.Checked)
1771
public static void DrawMixedCheckBox(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1774
public static void DrawMixedCheckBox(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1788
public static void DrawRadioButton(Graphics graphics, Rectangle rectangle,
ButtonState
state)
1794
public static void DrawRadioButton(Graphics graphics, int x, int y, int width, int height,
ButtonState
state)
1870
public static void DrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button,
ButtonState
state)
1880
ButtonState
state)
1887
ButtonState
.Pushed => ModernControlButtonState.Pressed,
1888
ButtonState
.Inactive => ModernControlButtonState.Disabled,
System.Windows.Forms.Design (3)
System\ComponentModel\Design\CollectionEditor.CollectionEditorCollectionForm.cs (1)
588
ControlPaint.DrawButton(g, button,
ButtonState
.Normal);
System\Windows\Forms\Design\AnchorEditor.AnchorUI.cs (1)
208
ControlPaint.DrawButton(e.Graphics, rc,
ButtonState
.Normal);
System\Windows\Forms\Design\DockEditor.DockUI.cs (1)
302
ControlPaint.DrawButton(e.Graphics, rc,
ButtonState
.Pushed);