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));
594
if (SelectionMode != SelectionMode.None && (e.State &
DrawItemState
.Selected) ==
DrawItemState
.Selected)
707
if ((e.State &
DrawItemState
.Focus) ==
DrawItemState
.Focus &&
708
(e.State &
DrawItemState
.NoFocusRect) !=
DrawItemState
.NoFocusRect)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (1)
2307
e.State.HasFlag(
DrawItemState
.Selected) ? GridEntry.PaintValueFlags.DrawSelected : default,
System\Windows\Forms\Rendering\DrawItemEventArgs.cs (12)
31
public DrawItemEventArgs(Graphics graphics, Font? font, Rectangle rect, int index,
DrawItemState
state)
44
DrawItemState
state,
77
State = (
DrawItemState
)state;
108
public
DrawItemState
State { get; }
115
=> (State &
DrawItemState
.Selected) ==
DrawItemState
.Selected ? SystemColors.HighlightText : _foreColor;
118
=> (State &
DrawItemState
.Selected) ==
DrawItemState
.Selected ? SystemColors.Highlight : _backColor;
134
if ((State &
DrawItemState
.Focus) ==
DrawItemState
.Focus
135
&& (State &
DrawItemState
.NoFocusRect) !=
DrawItemState
.NoFocusRect)
System.Windows.Forms.Design (6)
System\ComponentModel\Design\CollectionEditor.CollectionEditorCollectionForm.cs (4)
581
if ((e.State &
DrawItemState
.Selected) ==
DrawItemState
.Selected)
589
if ((e.State &
DrawItemState
.Focus) ==
DrawItemState
.Focus)
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (2)
1001
if ((e.State &
DrawItemState
.Selected) ==
DrawItemState
.Selected)
System.Windows.Forms.Tests (58)
CheckedListBoxTests.cs (9)
405
yield return new object[] { null, Rectangle.Empty, 0,
DrawItemState
.Default, Color.Red, Color.Blue };
406
yield return new object[] { null, new Rectangle(1, 2, 3, 4), 1,
DrawItemState
.None, Color.Red, Color.Blue };
407
yield return new object[] { null, new Rectangle(1, 2, 3, 4), 1,
DrawItemState
.Checked, Color.Red, Color.Blue };
408
yield return new object[] { new Font("Arial", 8.25f), new Rectangle(10, 20, 30, 40), 1,
DrawItemState
.Default, Color.Red, Color.Blue };
413
public void CheckedListBox_OnDrawItem_Invoke_Success(Font font, Rectangle rect, int index,
DrawItemState
state, Color foreColor, Color backColor)
428
public void CheckedListBox_OnDrawItem_InvokeWithHandle_Success(Font font, Rectangle rect, int index,
DrawItemState
state, Color foreColor, Color backColor)
464
DrawItemEventArgs e = new(graphics, null, new Rectangle(1, 2, 3, 4), -1,
DrawItemState
.Default);
475
DrawItemEventArgs e = new(graphics, null, new Rectangle(1, 2, 3, 4), 1,
DrawItemState
.Default);
488
DrawItemEventArgs e = new(graphics, null, new Rectangle(1, 2, 3, 4), 2,
DrawItemState
.Default);
System\Windows\Forms\ComboBoxTests.cs (4)
730
control.TestRaiseOnDrawItem(new DrawItemEventArgs(graphics, control.Font, default, 0,
DrawItemState
.Default));
747
control.TestRaiseOnDrawItem(new DrawItemEventArgs(Graphics.FromImage(bitmap), control.Font, default, 0,
DrawItemState
.Default));
776
control.TestRaiseOnDrawItem(new DrawItemEventArgs(graphics, control.Font, default, 0,
DrawItemState
.Default));
782
control.TestRaiseOnDrawItem(new DrawItemEventArgs(graphics, control.Font, default, 0,
DrawItemState
.Default));
System\Windows\Forms\DrawItemEventArgsTests.cs (42)
13
yield return new object[] { null, Rectangle.Empty, -2,
DrawItemState
.None - 1, SystemColors.HighlightText, SystemColors.Highlight };
14
yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), -1,
DrawItemState
.None, SystemColors.WindowText, SystemColors.Window };
15
yield return new object[] { SystemFonts.DefaultFont, new Rectangle(-1, 2, -3, -4), 0,
DrawItemState
.Selected, SystemColors.HighlightText, SystemColors.Highlight };
16
yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1,
DrawItemState
.Focus, SystemColors.WindowText, SystemColors.Window };
17
yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1,
DrawItemState
.Focus |
DrawItemState
.NoFocusRect, SystemColors.WindowText, SystemColors.Window };
22
public void DrawItemEventArgs_Ctor_Graphics_Font_Rectangle_Int_DrawItemState(Font font, Rectangle rect, int index,
DrawItemState
state, Color expectedForeColor, Color expectedBackColor)
38
yield return new object[] { null, Rectangle.Empty, -2,
DrawItemState
.None - 1, Color.Empty, Color.Empty };
39
yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), -1,
DrawItemState
.None, Color.Red, Color.Blue };
40
yield return new object[] { SystemFonts.DefaultFont, new Rectangle(-1, 2, -3, -4), 0,
DrawItemState
.Selected, Color.Red, Color.Blue };
41
yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1,
DrawItemState
.Focus, Color.Red, Color.Blue };
42
yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1,
DrawItemState
.Focus |
DrawItemState
.NoFocusRect, Color.Red, Color.Blue };
47
public void DrawItemEventArgs_Ctor_Graphics_Font_Rectangle_Int_DrawItemState_Color_Color(Font font, Rectangle rect, int index,
DrawItemState
state, Color foreColor, Color backColor)
58
Assert.Equal((state &
DrawItemState
.Selected) ==
DrawItemState
.Selected ? SystemColors.HighlightText : foreColor, e.ForeColor);
59
Assert.Equal((state &
DrawItemState
.Selected) ==
DrawItemState
.Selected ? SystemColors.Highlight : backColor, e.BackColor);
65
Assert.Throws<ArgumentNullException>("graphics", () => new DrawItemEventArgs(null, SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 0,
DrawItemState
.None));
66
Assert.Throws<ArgumentNullException>("graphics", () => new DrawItemEventArgs(null, SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 0,
DrawItemState
.None, Color.Red, Color.Blue));
71
yield return new object[] { new Rectangle(1, 2, 3, 4),
DrawItemState
.None };
72
yield return new object[] { new Rectangle(1, 2, 3, 4),
DrawItemState
.Selected };
73
yield return new object[] { new Rectangle(1, 2, 3, 4),
DrawItemState
.Focus };
74
yield return new object[] { new Rectangle(1, 2, 3, 4),
DrawItemState
.Focus |
DrawItemState
.Selected };
75
yield return new object[] { new Rectangle(1, 2, 3, 4),
DrawItemState
.Focus |
DrawItemState
.NoFocusRect };
76
yield return new object[] { new Rectangle(1, 2, 3, 4),
DrawItemState
.Focus |
DrawItemState
.NoFocusRect |
DrawItemState
.Selected };
77
yield return new object[] { new Rectangle(-1, -2, -3, -4),
DrawItemState
.None };
78
yield return new object[] { new Rectangle(-1, -2, -3, -4),
DrawItemState
.Selected };
79
yield return new object[] { new Rectangle(-1, -2, -3, -4),
DrawItemState
.Focus };
80
yield return new object[] { new Rectangle(-1, -2, -3, -4),
DrawItemState
.Focus |
DrawItemState
.Selected };
81
yield return new object[] { new Rectangle(-1, -2, -3, -4),
DrawItemState
.Focus |
DrawItemState
.NoFocusRect };
82
yield return new object[] { new Rectangle(-1, -2, -3, -4),
DrawItemState
.Focus |
DrawItemState
.NoFocusRect |
DrawItemState
.Selected };
87
public void DrawItemEventArgs_DrawBackground_Invoke_Success(Rectangle bounds,
DrawItemState
state)
97
public void DrawItemEventArgs_DrawFocusRectangle_Invoke_Success(Rectangle bounds,
DrawItemState
state)
System\Windows\Forms\DrawListViewColumnHeaderEventArgsTests.cs (1)
13
yield return new object[] { Rectangle.Empty, -2, null, (
DrawItemState
)(ListViewItemStates.Checked - 1), Color.Empty, Color.Empty, null };
System\Windows\Forms\ListBoxTests.cs (1)
5520
yield return new object[] { new DrawItemEventArgs(graphics, null, new Rectangle(1, 2, 3, 4), 0,
DrawItemState
.Checked) };
System\Windows\Forms\TabControlTests.cs (1)
4222
yield return new object[] { new DrawItemEventArgs(graphics, null, new Rectangle(1, 2, 3, 4), 0,
DrawItemState
.Checked) };