186 references to ButtonState
System.Windows.Forms (183)
System\Windows\Forms\Controls\Buttons\ButtonInternal\CheckBoxBaseAdapter.cs (7)
232protected ButtonState GetState() 234ButtonState style = 0; 238style |= ButtonState.Normal; 242style |= ButtonState.Checked; 247style |= ButtonState.Inactive; 252style |= ButtonState.Pushed; 260ButtonState style = GetState();
System\Windows\Forms\Controls\Buttons\ButtonInternal\RadioButtonBaseAdapter.cs (7)
168protected ButtonState GetState() 170ButtonState style = default; 174style |= ButtonState.Checked; 178style |= ButtonState.Normal; 183style |= ButtonState.Inactive; 188style |= ButtonState.Pushed; 202ButtonState style = GetState();
System\Windows\Forms\Controls\Buttons\ButtonRenderer.cs (4)
281internal static ButtonState ConvertToButtonState(PushButtonState state) => state switch 283PushButtonState.Pressed => ButtonState.Pushed, 284PushButtonState.Disabled => ButtonState.Inactive, 285_ => ButtonState.Normal,
System\Windows\Forms\Controls\Buttons\CheckBoxRenderer.cs (29)
255internal static ButtonState ConvertToButtonState(CheckBoxState state) => state switch 257CheckBoxState.CheckedNormal or CheckBoxState.CheckedHot => ButtonState.Checked, 258CheckBoxState.CheckedPressed => (ButtonState.Checked | ButtonState.Pushed), 259CheckBoxState.CheckedDisabled => (ButtonState.Checked | ButtonState.Inactive), 260CheckBoxState.UncheckedPressed => ButtonState.Pushed, 261CheckBoxState.UncheckedDisabled => ButtonState.Inactive, 263CheckBoxState.MixedNormal or CheckBoxState.MixedHot => ButtonState.Checked, 264CheckBoxState.MixedPressed => (ButtonState.Checked | ButtonState.Pushed), 265CheckBoxState.MixedDisabled => (ButtonState.Checked | ButtonState.Inactive), 266_ => ButtonState.Normal, 269internal static CheckBoxState ConvertFromButtonState(ButtonState state, bool isMixed, bool isHot) 273if ((state & ButtonState.Pushed) == ButtonState.Pushed) 277else if ((state & ButtonState.Inactive) == ButtonState.Inactive) 288else if ((state & ButtonState.Checked) == ButtonState.Checked) 290if ((state & ButtonState.Pushed) == ButtonState.Pushed) 294else if ((state & ButtonState.Inactive) == ButtonState.Inactive) 308if ((state & ButtonState.Pushed) == ButtonState.Pushed) 312else if ((state & ButtonState.Inactive) == ButtonState.Inactive)
System\Windows\Forms\Controls\Buttons\RadioButtonRenderer.cs (20)
268internal static ButtonState ConvertToButtonState(RadioButtonState state) => state switch 270RadioButtonState.CheckedNormal or RadioButtonState.CheckedHot => ButtonState.Checked, 271RadioButtonState.CheckedPressed => ButtonState.Checked | ButtonState.Pushed, 272RadioButtonState.CheckedDisabled => ButtonState.Checked | ButtonState.Inactive, 273RadioButtonState.UncheckedPressed => ButtonState.Pushed, 274RadioButtonState.UncheckedDisabled => ButtonState.Inactive, 275_ => ButtonState.Normal, 278internal static RadioButtonState ConvertFromButtonState(ButtonState state, bool isHot) 280if ((state & ButtonState.Checked) == ButtonState.Checked) 282if ((state & ButtonState.Pushed) == ButtonState.Pushed) 286else if ((state & ButtonState.Inactive) == ButtonState.Inactive) 300if ((state & ButtonState.Pushed) == ButtonState.Pushed) 304else if ((state & ButtonState.Inactive) == ButtonState.Inactive)
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (34)
38private ButtonState ButtonState 40get => Properties.GetValueOrDefault(s_propButtonCellState, ButtonState.Normal); 45Debug.Assert((value & ~(ButtonState.Normal | ButtonState.Pushed | ButtonState.Checked)) == 0); 48Properties.AddOrRemoveValue(s_propButtonCellState, value, defaultValue: ButtonState.Normal); 449ButtonState.HasFlag(ButtonState.Pushed); 463UpdateButtonState(ButtonState | ButtonState.Checked, rowIndex); 477UpdateButtonState(ButtonState & ~ButtonState.Checked, rowIndex); 500if (ButtonState != ButtonState.Normal) 503UpdateButtonState(ButtonState.Normal, rowIndex); 517UpdateButtonState(ButtonState | ButtonState.Pushed, e.RowIndex); 539if (ButtonState.HasFlag(ButtonState.Pushed) && 543UpdateButtonState(ButtonState & ~ButtonState.Pushed, rowIndex); 567if (!ButtonState.HasFlag(ButtonState.Pushed) && 571UpdateButtonState(ButtonState | ButtonState.Pushed, e.RowIndex); 573else if (ButtonState.HasFlag(ButtonState.Pushed) && !s_mouseInContentBounds) 575UpdateButtonState(ButtonState & ~ButtonState.Pushed, e.RowIndex); 592UpdateButtonState(ButtonState & ~ButtonState.Pushed, e.RowIndex); 721if ((ButtonState & (ButtonState.Pushed | ButtonState.Checked)) != 0) 750(ButtonState == ButtonState.Normal) ? ButtonBorderStyle.Outset : ButtonBorderStyle.Inset); 768if ((ButtonState & (ButtonState.Pushed | ButtonState.Checked)) != 0) 799if ((ButtonState & (ButtonState.Pushed | ButtonState.Checked)) != 0) 891if ((ButtonState & (ButtonState.Pushed | ButtonState.Checked)) != 0 || 926if ((ButtonState & (ButtonState.Pushed | ButtonState.Checked)) != 0 || 931bool paintUp = (ButtonState == ButtonState.Normal); 963if ((ButtonState & (ButtonState.Pushed | ButtonState.Checked)) != 0 && 1010private void UpdateButtonState(ButtonState newButtonState, int rowIndex)
System\Windows\Forms\Controls\DataGridView\DataGridViewCheckBoxCell.cs (31)
180private ButtonState ButtonState 182get => Properties.GetValueOrDefault(s_propButtonCellState, ButtonState.Normal); 187Debug.Assert((value & ~(ButtonState.Normal | ButtonState.Pushed | ButtonState.Checked)) == 0); 190Properties.AddOrRemoveValue(s_propButtonCellState, value, defaultValue: ButtonState.Normal); 770protected override bool MouseLeaveUnsharesRow(int rowIndex) => ButtonState.HasFlag(ButtonState.Pushed); 814UpdateButtonState(ButtonState | ButtonState.Checked, rowIndex); 828UpdateButtonState(ButtonState & ~ButtonState.Checked, rowIndex); 853if (ButtonState != ButtonState.Normal) 856UpdateButtonState(ButtonState.Normal, rowIndex); 870UpdateButtonState(ButtonState | ButtonState.Pushed, e.RowIndex); 892if (ButtonState.HasFlag(ButtonState.Pushed) && 896UpdateButtonState(ButtonState & ~ButtonState.Pushed, rowIndex); 920if (!ButtonState.HasFlag(ButtonState.Pushed) && 924UpdateButtonState(ButtonState | ButtonState.Pushed, e.RowIndex); 926else if (ButtonState.HasFlag(ButtonState.Pushed) && !s_mouseInContentBounds) 928UpdateButtonState(ButtonState & ~ButtonState.Pushed, e.RowIndex); 945UpdateButtonState(ButtonState & ~ButtonState.Pushed, e.RowIndex); 1078ButtonState bs; 1090bs = (checkState == CheckState.Unchecked) ? ButtonState.Normal : ButtonState.Checked; 1098bs = ButtonState.Checked; 1103bs = ButtonState.Normal; 1109bs = ButtonState.Normal; // Default rendering of the checkbox with wrong formatted value type. 1113if ((ButtonState & (ButtonState.Pushed | ButtonState.Checked)) != 0) 1115bs |= ButtonState.Pushed; 1394if ((ButtonState & (ButtonState.Pushed | ButtonState.Checked)) != 0) 1702private void UpdateButtonState(ButtonState newButtonState, int rowIndex)
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (2)
803if (ButtonState != ButtonState.Normal) 805Debug.Assert(ButtonState == ButtonState.Pushed);
System\Windows\Forms\Controls\DataGridView\DataGridViewHeaderCell.cs (12)
29protected ButtonState ButtonState 31get => Properties.GetValueOrDefault(s_propButtonState, ButtonState.Normal); 32private set => Properties.AddOrRemoveValue(s_propButtonState, value, defaultValue: ButtonState.Normal); 438DataGridView is not null && ButtonState != ButtonState.Normal && DataGridView.ApplyVisualStylesToHeaderCells; 454UpdateButtonState(ButtonState.Pushed, e.RowIndex); 469ButtonState == ButtonState.Normal && 473UpdateButtonState(ButtonState.Pushed, rowIndex); 489if (ButtonState != ButtonState.Normal) 491Debug.Assert(ButtonState == ButtonState.Pushed); 494UpdateButtonState(ButtonState.Normal, rowIndex); 510UpdateButtonState(ButtonState.Normal, e.RowIndex); 561private void UpdateButtonState(ButtonState newButtonState, int rowIndex)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (2)
685if (ButtonState != ButtonState.Normal) 687Debug.Assert(ButtonState == ButtonState.Pushed);
System\Windows\Forms\Controls\DataGridView\DataGridViewTopLeftHeaderCell.cs (2)
248if (ButtonState != ButtonState.Normal) 250Debug.Assert(ButtonState == ButtonState.Pushed);
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (6)
501ButtonState state = ButtonState.Normal; 504state |= ButtonState.Flat; 512state |= ButtonState.Checked; 515state |= ButtonState.Checked | ButtonState.Inactive;
System\Windows\Forms\Controls\ToolStrips\ToolStripMenuItem.cs (1)
711ControlPaint.DrawCaptionButton(g, new Rectangle(Point.Empty, image.Size), (CaptionButton)buttonToUse, ButtonState.Flat);
System\Windows\Forms\Rendering\ControlPaint.cs (26)
1211public static void DrawButton(Graphics graphics, Rectangle rectangle, ButtonState state) 1217public static void DrawButton(Graphics graphics, int x, int y, int width, int height, ButtonState state) 1235ButtonState state) => DrawCaptionButton( 1248ButtonState state) => DrawFrameControl( 1259public static void DrawCheckBox(Graphics graphics, Rectangle rectangle, ButtonState state) 1265public static void DrawCheckBox(Graphics graphics, int x, int y, int width, int height, ButtonState state) 1268if ((state & ButtonState.Flat) == ButtonState.Flat) 1287public static void DrawComboButton(Graphics graphics, Rectangle rectangle, ButtonState state) 1293public static void DrawComboButton(Graphics graphics, int x, int y, int width, int height, ButtonState state) 1349private static void DrawFlatCheckBox(Graphics graphics, Rectangle rectangle, ButtonState state) 1355Brush background = ((state & ButtonState.Inactive) == ButtonState.Inactive) 1358Color foreground = ((state & ButtonState.Inactive) == ButtonState.Inactive) 1374ButtonState state) 1390if ((state & ButtonState.Checked) == ButtonState.Checked) 1771public static void DrawMixedCheckBox(Graphics graphics, Rectangle rectangle, ButtonState state) 1774public static void DrawMixedCheckBox(Graphics graphics, int x, int y, int width, int height, ButtonState state) 1788public static void DrawRadioButton(Graphics graphics, Rectangle rectangle, ButtonState state) 1794public static void DrawRadioButton(Graphics graphics, int x, int y, int width, int height, ButtonState state) 1870public static void DrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state) 1880ButtonState state) 1887ButtonState.Pushed => ModernControlButtonState.Pressed, 1888ButtonState.Inactive => ModernControlButtonState.Disabled,
System.Windows.Forms.Design (3)
System\ComponentModel\Design\CollectionEditor.CollectionEditorCollectionForm.cs (1)
588ControlPaint.DrawButton(g, button, ButtonState.Normal);
System\Windows\Forms\Design\AnchorEditor.AnchorUI.cs (1)
208ControlPaint.DrawButton(e.Graphics, rc, ButtonState.Normal);
System\Windows\Forms\Design\DockEditor.DockUI.cs (1)
302ControlPaint.DrawButton(e.Graphics, rc, ButtonState.Pushed);