87 references to DrawItemState
System.Windows.Forms (23)
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\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 (6)
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.Tests (58)
CheckedListBoxTests.cs (9)
405yield return new object[] { null, Rectangle.Empty, 0, DrawItemState.Default, Color.Red, Color.Blue }; 406yield return new object[] { null, new Rectangle(1, 2, 3, 4), 1, DrawItemState.None, Color.Red, Color.Blue }; 407yield return new object[] { null, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Checked, Color.Red, Color.Blue }; 408yield return new object[] { new Font("Arial", 8.25f), new Rectangle(10, 20, 30, 40), 1, DrawItemState.Default, Color.Red, Color.Blue }; 413public void CheckedListBox_OnDrawItem_Invoke_Success(Font font, Rectangle rect, int index, DrawItemState state, Color foreColor, Color backColor) 428public void CheckedListBox_OnDrawItem_InvokeWithHandle_Success(Font font, Rectangle rect, int index, DrawItemState state, Color foreColor, Color backColor) 464DrawItemEventArgs e = new(graphics, null, new Rectangle(1, 2, 3, 4), -1, DrawItemState.Default); 475DrawItemEventArgs e = new(graphics, null, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Default); 488DrawItemEventArgs e = new(graphics, null, new Rectangle(1, 2, 3, 4), 2, DrawItemState.Default);
System\Windows\Forms\ComboBoxTests.cs (4)
730control.TestRaiseOnDrawItem(new DrawItemEventArgs(graphics, control.Font, default, 0, DrawItemState.Default)); 747control.TestRaiseOnDrawItem(new DrawItemEventArgs(Graphics.FromImage(bitmap), control.Font, default, 0, DrawItemState.Default)); 776control.TestRaiseOnDrawItem(new DrawItemEventArgs(graphics, control.Font, default, 0, DrawItemState.Default)); 782control.TestRaiseOnDrawItem(new DrawItemEventArgs(graphics, control.Font, default, 0, DrawItemState.Default));
System\Windows\Forms\DrawItemEventArgsTests.cs (42)
13yield return new object[] { null, Rectangle.Empty, -2, DrawItemState.None - 1, SystemColors.HighlightText, SystemColors.Highlight }; 14yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), -1, DrawItemState.None, SystemColors.WindowText, SystemColors.Window }; 15yield return new object[] { SystemFonts.DefaultFont, new Rectangle(-1, 2, -3, -4), 0, DrawItemState.Selected, SystemColors.HighlightText, SystemColors.Highlight }; 16yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus, SystemColors.WindowText, SystemColors.Window }; 17yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus | DrawItemState.NoFocusRect, SystemColors.WindowText, SystemColors.Window }; 22public void DrawItemEventArgs_Ctor_Graphics_Font_Rectangle_Int_DrawItemState(Font font, Rectangle rect, int index, DrawItemState state, Color expectedForeColor, Color expectedBackColor) 38yield return new object[] { null, Rectangle.Empty, -2, DrawItemState.None - 1, Color.Empty, Color.Empty }; 39yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), -1, DrawItemState.None, Color.Red, Color.Blue }; 40yield return new object[] { SystemFonts.DefaultFont, new Rectangle(-1, 2, -3, -4), 0, DrawItemState.Selected, Color.Red, Color.Blue }; 41yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus, Color.Red, Color.Blue }; 42yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus | DrawItemState.NoFocusRect, Color.Red, Color.Blue }; 47public void DrawItemEventArgs_Ctor_Graphics_Font_Rectangle_Int_DrawItemState_Color_Color(Font font, Rectangle rect, int index, DrawItemState state, Color foreColor, Color backColor) 58Assert.Equal((state & DrawItemState.Selected) == DrawItemState.Selected ? SystemColors.HighlightText : foreColor, e.ForeColor); 59Assert.Equal((state & DrawItemState.Selected) == DrawItemState.Selected ? SystemColors.Highlight : backColor, e.BackColor); 65Assert.Throws<ArgumentNullException>("graphics", () => new DrawItemEventArgs(null, SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 0, DrawItemState.None)); 66Assert.Throws<ArgumentNullException>("graphics", () => new DrawItemEventArgs(null, SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 0, DrawItemState.None, Color.Red, Color.Blue)); 71yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.None }; 72yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Selected }; 73yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Focus }; 74yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Focus | DrawItemState.Selected }; 75yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Focus | DrawItemState.NoFocusRect }; 76yield return new object[] { new Rectangle(1, 2, 3, 4), DrawItemState.Focus | DrawItemState.NoFocusRect | DrawItemState.Selected }; 77yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.None }; 78yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Selected }; 79yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Focus }; 80yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Focus | DrawItemState.Selected }; 81yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Focus | DrawItemState.NoFocusRect }; 82yield return new object[] { new Rectangle(-1, -2, -3, -4), DrawItemState.Focus | DrawItemState.NoFocusRect | DrawItemState.Selected }; 87public void DrawItemEventArgs_DrawBackground_Invoke_Success(Rectangle bounds, DrawItemState state) 97public void DrawItemEventArgs_DrawFocusRectangle_Invoke_Success(Rectangle bounds, DrawItemState state)
System\Windows\Forms\DrawListViewColumnHeaderEventArgsTests.cs (1)
13yield return new object[] { Rectangle.Empty, -2, null, (DrawItemState)(ListViewItemStates.Checked - 1), Color.Empty, Color.Empty, null };
System\Windows\Forms\ListBoxTests.cs (1)
5520yield return new object[] { new DrawItemEventArgs(graphics, null, new Rectangle(1, 2, 3, 4), 0, DrawItemState.Checked) };
System\Windows\Forms\TabControlTests.cs (1)
4222yield return new object[] { new DrawItemEventArgs(graphics, null, new Rectangle(1, 2, 3, 4), 0, DrawItemState.Checked) };