98 references to DrawItemState
System.Windows.Forms (25)
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (10)
526(e.State & DrawItemState.HotLight) == DrawItemState.HotLight); 559((e.State & DrawItemState.HotLight) == DrawItemState.HotLight)); 594if (SelectionMode != SelectionMode.None && (e.State & DrawItemState.Selected) == DrawItemState.Selected) 707if ((e.State & DrawItemState.Focus) == DrawItemState.Focus && 708(e.State & DrawItemState.NoFocusRect) != DrawItemState.NoFocusRect)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (1)
2307e.State.HasFlag(DrawItemState.Selected) ? GridEntry.PaintValueFlags.DrawSelected : default,
System\Windows\Forms\Controls\Unsupported\StatusBar\StatusBarDrawItemEventArgs.cs (2)
28DrawItemState itemState, 41DrawItemState itemState,
System\Windows\Forms\Rendering\DrawItemEventArgs.cs (12)
31public DrawItemEventArgs(Graphics graphics, Font? font, Rectangle rect, int index, DrawItemState state) 44DrawItemState state, 77State = (DrawItemState)state; 108public DrawItemState State { get; } 115=> (State & DrawItemState.Selected) == DrawItemState.Selected ? SystemColors.HighlightText : _foreColor; 118=> (State & DrawItemState.Selected) == DrawItemState.Selected ? SystemColors.Highlight : _backColor; 134if ((State & DrawItemState.Focus) == DrawItemState.Focus 135&& (State & DrawItemState.NoFocusRect) != DrawItemState.NoFocusRect)
System.Windows.Forms.Design (12)
System\ComponentModel\Design\CollectionEditor.CollectionEditorCollectionForm.cs (4)
581if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) 589if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (2)
1001if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
System\Windows\Forms\Design\ToolStripCollectionEditor.ToolStripItemEditorForm.cs (6)
661bool isComboEditBox = (e.State & DrawItemState.ComboBoxEdit) == DrawItemState.ComboBoxEdit; 770if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) 789if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)
System.Windows.Forms.Tests (60)
CheckedListBoxTests.cs (9)
407yield return new object[] { null, Rectangle.Empty, 0, DrawItemState.Default, Color.Red, Color.Blue }; 408yield return new object[] { null, new Rectangle(1, 2, 3, 4), 1, DrawItemState.None, Color.Red, Color.Blue }; 409yield return new object[] { null, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Checked, Color.Red, Color.Blue }; 410yield return new object[] { new Font("Arial", 8.25f), new Rectangle(10, 20, 30, 40), 1, DrawItemState.Default, Color.Red, Color.Blue }; 415public void CheckedListBox_OnDrawItem_Invoke_Success(Font font, Rectangle rect, int index, DrawItemState state, Color foreColor, Color backColor) 430public void CheckedListBox_OnDrawItem_InvokeWithHandle_Success(Font font, Rectangle rect, int index, DrawItemState state, Color foreColor, Color backColor) 466DrawItemEventArgs e = new(graphics, null, new Rectangle(1, 2, 3, 4), -1, DrawItemState.Default); 477DrawItemEventArgs e = new(graphics, null, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Default); 490DrawItemEventArgs e = new(graphics, null, new Rectangle(1, 2, 3, 4), 2, DrawItemState.Default);
System\Windows\Forms\ComboBoxTests.cs (4)
732control.TestRaiseOnDrawItem(new DrawItemEventArgs(graphics, control.Font, default, 0, DrawItemState.Default)); 749control.TestRaiseOnDrawItem(new DrawItemEventArgs(Graphics.FromImage(bitmap), control.Font, default, 0, DrawItemState.Default)); 778control.TestRaiseOnDrawItem(new DrawItemEventArgs(graphics, control.Font, default, 0, DrawItemState.Default)); 784control.TestRaiseOnDrawItem(new DrawItemEventArgs(graphics, control.Font, default, 0, DrawItemState.Default));
System\Windows\Forms\DrawItemEventArgsTests.cs (42)
15yield return new object[] { null, Rectangle.Empty, -2, DrawItemState.None - 1, SystemColors.HighlightText, SystemColors.Highlight }; 16yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), -1, DrawItemState.None, SystemColors.WindowText, SystemColors.Window }; 17yield return new object[] { SystemFonts.DefaultFont, new Rectangle(-1, 2, -3, -4), 0, DrawItemState.Selected, SystemColors.HighlightText, SystemColors.Highlight }; 18yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus, SystemColors.WindowText, SystemColors.Window }; 19yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus | DrawItemState.NoFocusRect, SystemColors.WindowText, SystemColors.Window }; 24public void DrawItemEventArgs_Ctor_Graphics_Font_Rectangle_Int_DrawItemState(Font font, Rectangle rect, int index, DrawItemState state, Color expectedForeColor, Color expectedBackColor) 40yield return new object[] { null, Rectangle.Empty, -2, DrawItemState.None - 1, Color.Empty, Color.Empty }; 41yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), -1, DrawItemState.None, Color.Red, Color.Blue }; 42yield return new object[] { SystemFonts.DefaultFont, new Rectangle(-1, 2, -3, -4), 0, DrawItemState.Selected, Color.Red, Color.Blue }; 43yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus, Color.Red, Color.Blue }; 44yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus | DrawItemState.NoFocusRect, Color.Red, Color.Blue }; 49public void DrawItemEventArgs_Ctor_Graphics_Font_Rectangle_Int_DrawItemState_Color_Color(Font font, Rectangle rect, int index, DrawItemState state, Color foreColor, Color backColor) 60Assert.Equal((state & DrawItemState.Selected) == DrawItemState.Selected ? SystemColors.HighlightText : foreColor, e.ForeColor); 61Assert.Equal((state & DrawItemState.Selected) == DrawItemState.Selected ? SystemColors.Highlight : backColor, e.BackColor); 67Assert.Throws<ArgumentNullException>("graphics", () => new DrawItemEventArgs(null, SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 0, DrawItemState.None)); 68Assert.Throws<ArgumentNullException>("graphics", () => new DrawItemEventArgs(null, SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 0, DrawItemState.None, Color.Red, Color.Blue)); 73yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.None }; 74yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Selected }; 75yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Focus }; 76yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Focus | DrawItemState.Selected }; 77yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Focus | DrawItemState.NoFocusRect }; 78yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Focus | DrawItemState.NoFocusRect | DrawItemState.Selected }; 79yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.None }; 80yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Selected }; 81yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Focus }; 82yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Focus | DrawItemState.Selected }; 83yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Focus | DrawItemState.NoFocusRect }; 84yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Focus | DrawItemState.NoFocusRect | DrawItemState.Selected }; 89public void DrawItemEventArgs_DrawBackground_Invoke_Success(Rectangle bounds, DrawItemState state) 99public void DrawItemEventArgs_DrawFocusRectangle_Invoke_Success(Rectangle bounds, DrawItemState state)
System\Windows\Forms\DrawListViewColumnHeaderEventArgsTests.cs (1)
15yield return new object[] { Rectangle.Empty, -2, null, (DrawItemState)(ListViewItemStates.Checked - 1), Color.Empty, Color.Empty, null };
System\Windows\Forms\ListBoxTests.cs (1)
5522yield return new object[] { new DrawItemEventArgs(graphics, null, new Rectangle(1, 2, 3, 4), 0, DrawItemState.Checked) };
System\Windows\Forms\TabControlTests.cs (1)
4224yield return new object[] { new DrawItemEventArgs(graphics, null, new Rectangle(1, 2, 3, 4), 0, DrawItemState.Checked) };
System\Windows\Forms\UnsupportedTypesTests.cs (2)
85((Action)(() => new StatusBarDrawItemEventArgs(graphics, font: null!, rectangle, itemId: 0, DrawItemState.Checked, panel: null!))) 87((Action)(() => new StatusBarDrawItemEventArgs(graphics, font: null!, rectangle, itemId: 0, DrawItemState.Checked, panel: null!, foreColor: Color.Red, backColor: Color.Black)))
UnsupportedTypes (1)
CreateFrameworkTypes.cs (1)
420OnDrawItem(new StatusBarDrawItemEventArgs(CreateGraphics(), font: null!, r: new(1, 1, 1, 1), itemId: 1, DrawItemState.Default, Panels[0]));