6 instantiations of Scope
System.Windows.Forms (2)
System\Windows\Forms\Rendering\GdiCache.cs (1)
95return font is null ? new FontCache.Scope() : s_fontCache.GetEntry(font, quality).CreateScope();
System\Windows\Forms\Rendering\TextRenderer.cs (1)
667return new FontCache.Scope(hfont);
System.Windows.Forms.Primitives (4)
System\Windows\Forms\GdiPlus\GdiPlusCache.cs (3)
37return new PenCache.Scope(pen); 54return new SolidBrushCache.Scope(solidBrush); 77=> width == 1 ? GetPenScope(color) : new PenCache.Scope(new Pen(color, width));
System\Windows\Forms\RefCountedCache.CacheEntry.cs (1)
64public Scope CreateScope() => new(this);
221 references to Scope
System.Windows.Forms (193)
System\Windows\Forms\Control.cs (1)
8228using var brush = color.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (5)
341using var brush = color.GetCachedSolidBrushScope(); 439using var pen = color.GetCachedPenScope(); 474using var highlightBrush = colors.Highlight.GetCachedSolidBrushScope(); 479using var shadowBrush = colors.ButtonShadow.GetCachedSolidBrushScope(); 484using var brush = color.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonPopupAdapter.cs (3)
89using var windowFrame = colors.WindowFrame.GetCachedPenScope(); 90using var highlight = colors.Highlight.GetCachedPenScope(); 91using var buttonShadow = colors.ButtonShadow.GetCachedPenScope();
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonStandardAdapter.cs (1)
77using var brush = color.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\Buttons\ButtonInternal\DarkMode\FlatButtonDarkModeRenderer.cs (1)
29using var back = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\Buttons\ButtonInternal\DarkMode\PopupButtonDarkModeRenderer.cs (1)
52using var brush = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\Buttons\ButtonInternal\DarkMode\SystemButtonDarkModeRenderer.cs (4)
41using var brush = backColor.GetCachedSolidBrushScope(); 64using var focusPen = Color.White.GetCachedPenScope(FocusedButtonBorderThickness); 176using var topLeftPen = topLeftColor.GetCachedPenScope(borderThickness); 180using var bottomRightPen = bottomRightColor.GetCachedPenScope(borderThickness);
System\Windows\Forms\Controls\Buttons\ButtonInternal\RadioButtonBaseAdapter.cs (4)
40using var fieldBrush = field.GetCachedSolidBrushScope(); 41using var dark = colors.ButtonShadow.GetCachedPenScope(); 42using var light = colors.ButtonFace.GetCachedPenScope(); 43using var lightLight = colors.Highlight.GetCachedPenScope();
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (1)
832using (var hfont = GdiCache.GetHFONTScope(Font))
System\Windows\Forms\Controls\ComboBox\ComboBox.FlatComboAdapter.cs (4)
85using var b = innerBorderColor.GetCachedSolidBrushScope(); 91using var outerBorderPen = outerBorderColor.GetCachedPenScope(); 107using var innerBorderPen = innerBorderColor.GetCachedPenScope(); 117using var borderPen = borderPenColor.GetCachedPenScope();
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (5)
5669using var brush = SystemColors.HotTrack.GetCachedSolidBrushScope(); 19223using var brush = BackgroundColor.GetCachedSolidBrushScope(); 19267using var brush = BackgroundColor.GetCachedSolidBrushScope(); 19313using var pen = VisualStyleInformation.TextControlBorder.GetCachedPenScope(); 19323using var pen = SystemColors.ControlText.GetCachedPenScope();
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (1)
689using var backBrush = backBrushColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (6)
3139using var penBackColor = cellStyle.BackColor.GetCachedPenScope(); 3140using var penGridColor = DataGridView.GridPenColor.GetCachedPenScope(); 3143using var penControlDark = darkColor.GetCachedPenScope(); 3144using var penControlLightLight = lightColor.GetCachedPenScope(); 3161using var dividerWidthBrush = dividerWidthColor.GetCachedSolidBrushScope(); 3196using var dividerHeightColorBrush = dividerHeightColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\DataGridView\DataGridViewCheckBoxCell.cs (3)
1124using var brush = brushColor.GetCachedSolidBrushScope(); 1320using var pen = foreBrushColor.GetCachedPenScope(); 1337using var highBrush = highlight.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (3)
872using var brush = brushColor.GetCachedSolidBrushScope(); 1005using var penControlDark = darkColor.GetCachedPenScope(); 1006using var penControlLightLight = lightColor.GetCachedPenScope();
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.cs (1)
1927using var brush = paint && !brushColor.HasTransparency() ? brushColor.GetCachedSolidBrushScope() : default;
System\Windows\Forms\Controls\DataGridView\DataGridViewHeaderCell.cs (1)
549using var brush = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (1)
780using var brush = paint ? brushColor.GetCachedSolidBrushScope() : default;
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (1)
916using var brush = brushColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (1)
741using var brush = brushColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxCell.cs (1)
689using var brush = brushColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\DataGridView\DataGridViewTopLeftHeaderCell.cs (4)
270using var brush = brushColor.GetCachedSolidBrushScope(); 377using var penControlDark = darkColor.GetCachedPenScope(); 383using var penControlLightLight = lightColor.GetCachedPenScope(); 389using var penControlDark = darkColor.GetCachedPenScope();
System\Windows\Forms\Controls\GroupBox\GroupBox.cs (4)
472using var textBrush = ForeColor.GetCachedSolidBrushScope(); 513using var hfont = GdiCache.GetHFONTScope(Font); 560using var boxPen = boxColor.GetCachedPenScope(); 668using var brush = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\GroupBox\GroupBoxRenderer.cs (2)
249using var light = ControlPaint.Light(backColor, 1.0f).GetCachedPenScope(); 250using var dark = ControlPaint.Dark(backColor, 0f).GetCachedPenScope();
System\Windows\Forms\Controls\Labels\Label.cs (3)
1063using var hfont = GdiCache.GetHFONTScope(Font); 1121using var hfont = GdiCache.GetHFONTScope(Font); 1283using var brush = color.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\Labels\LinkLabel.cs (4)
574using var hfont = GdiCache.GetHFONTScope(Font); 1010using var foreBrush = ForeColor.GetCachedSolidBrushScope(); 1011using var linkBrush = LinkColor.GetCachedSolidBrushScope(); 1292using var useBrush = brushColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (3)
624using var brush = backColor.GetCachedSolidBrushScope(); 683using var brush = foreColor.GetCachedSolidBrushScope(); 742using var brush = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (1)
2326using var pen = VisualStyleInformation.TextControlBorder.GetCachedPenScope();
System\Windows\Forms\Controls\ListView\DrawListViewColumnHeaderEventArgs.cs (1)
95using (var backBrush = BackColor.GetCachedSolidBrushScope())
System\Windows\Forms\Controls\ListView\DrawListViewItemEventArgs.cs (1)
65using var backBrush = Item.BackColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\ListView\DrawListViewSubItemEventArgs.cs (1)
97using var backBrush = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\ListView\ListView.cs (1)
6961using var pen = VisualStyleInformation.TextControlBorder.GetCachedPenScope();
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.cs (1)
1187using (var hfont = GdiCache.GetHFONTScope(Font))
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.cs (1)
2893using var backgroundBrush = BackColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.SnappableControl.cs (1)
44using var borderPen = BorderColor.GetCachedPenScope();
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\CategoryGridEntry.cs (2)
136using var topLinePen = OwnerGrid.CategorySplitterColor.GetCachedPenScope(); 153using var topLinePen = OwnerGrid.CategorySplitterColor.GetCachedPenScope();
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\GridEntry.cs (9)
1533using var backBrush = backColor.GetCachedSolidBrushScope(); 1543using var linePen = ownerGrid.LineColor.GetCachedPenScope(); 1556using var stripeBrush = ownerGrid.LineColor.GetCachedSolidBrushScope(); 1561using var focusBrush = ownerGrid.SelectedItemWithFocusBackColor.GetCachedSolidBrushScope(); 1590using var textBrush = textColor.GetCachedSolidBrushScope(); 1670using var brush = textColor.GetCachedSolidBrushScope(); 1741using var brush = BackgroundColor.GetCachedSolidBrushScope(); 1746using var pen = penColor.GetCachedPenScope(); 1829using var backBrush = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (5)
2388using var brush = color.GetCachedSolidBrushScope(); 3339using var splitterPen = OwnerGrid.LineColor.GetCachedPenScope(SplitterWidth); 3343using var linePen = g.FindNearestColor(OwnerGrid.LineColor).GetCachedPenScope(); 3390using var backBrush = BackColor.GetCachedSolidBrushScope(); 3395using var borderPen = OwnerGrid.ViewBorderColor.GetCachedPenScope();
System\Windows\Forms\Controls\TextBox\MaskedTextBox.cs (1)
2891using var pen = VisualStyleInformation.TextControlBorder.GetCachedPenScope();
System\Windows\Forms\Controls\TextBox\TextBox.cs (1)
821using var pen = VisualStyleInformation.TextControlBorder.GetCachedPenScope();
System\Windows\Forms\Controls\ToolStrips\ToolStripComboBox.ToolStripComboBoxControl.ToolStripComboBoxFlatComboAdapter.cs (1)
102using var b = colorTable.ComboBoxButtonOnOverflow.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\ToolStrips\ToolstripProfessionalRenderer.cs (33)
300using var brush = Application.IsDarkModeEnabled ? 372using var pen = ColorTable.ButtonSelectedBorder.GetCachedPenScope(); 386using var pen = ColorTable.ButtonSelectedBorder.GetCachedPenScope(); 419using (var pen = ColorTable.ToolStripBorder.GetCachedPenScope()) 522using var gripLightBrush = ColorTable.GripLight.GetCachedSolidBrushScope(); 530using var controlTextBrush = SystemColors.ControlText.GetCachedSolidBrushScope(); 586using var pen = borderColor.GetCachedPenScope(); 605using var brush = item.BackColor.GetCachedSolidBrushScope(); 643using var pen = borderColor.GetCachedPenScope(); 656using var brush = item.BackColor.GetCachedSolidBrushScope(); 661using var pen = ColorTable.MenuItemBorder.GetCachedPenScope(); 930using (var brush = overflowBottomLeftShadow.GetCachedSolidBrushScope()) 936using (var brush = overflowTopShadow.GetCachedSolidBrushScope()) 986using (var brush = middleColor.GetCachedSolidBrushScope()) 1057using var brush = fill.GetCachedSolidBrushScope(); 1060using var pen = ColorTable.ButtonSelectedBorder.GetCachedPenScope(); 1094using var pen = ColorTable.MenuBorder.GetCachedPenScope(); 1132using var brush = beginColor.GetCachedSolidBrushScope(); 1184using var brush = ColorTable.ToolStripDropDownBackground.GetCachedSolidBrushScope(); 1196using (var pen = ColorTable.MenuBorder.GetCachedPenScope()) 1204using var brush = ColorTable.ToolStripDropDownBackground.GetCachedSolidBrushScope(); 1268using var pen = overflowBottomLeftShadow.GetCachedPenScope(); 1293using (var brush = overflowTopShadow.GetCachedSolidBrushScope()) 1316using (var brush = overflowButtonGradientBegin.GetCachedSolidBrushScope()) 1350using (var brush = ColorTable.ToolStripGradientMiddle.GetCachedSolidBrushScope()) 1384using (var brush = ColorTable.ToolStripGradientEnd.GetCachedSolidBrushScope()) 1422using var brush = ColorTable.ButtonSelectedHighlight.GetCachedSolidBrushScope(); 1446using var brush = ColorTable.ButtonCheckedHighlight.GetCachedSolidBrushScope(); 1494using var foreColorPen = ColorTable.SeparatorDark.GetCachedPenScope(); 1495using var highlightColorPen = ColorTable.SeparatorLight.GetCachedPenScope(); 1557using var brush = ColorTable.ButtonPressedHighlight.GetCachedSolidBrushScope(); 1588using var brush = item.BackColor.GetCachedSolidBrushScope(); 1594using var pen = ColorTable.ButtonSelectedBorder.GetCachedPenScope();
System\Windows\Forms\Controls\ToolStrips\ToolStripRenderer.cs (1)
693using var brush = arrowColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\ToolStrips\ToolStripSystemDarkModeRenderer.cs (22)
74private static SolidBrushCache.Scope GetDarkModeBrush(Color color) => 82private static PenCache.Scope GetDarkModePen(Color color) => 106using var brush = GetDarkModeBrush(backColor); 184using var borderPen = GetDarkModePen(SystemColors.ControlDark); 215using var borderPen = GetDarkModePen(SystemColors.ControlDark); 239using var highlightBrush = GetDarkModeBrush(SystemColors.Highlight); 291using var fillColor = isPressed 326using var fillColor = splitButton.Pressed 335using var linePen = GetDarkModePen(SystemColors.ControlDark); 377using var leftPen = GetDarkModeColor(SystemColors.ControlDark).GetCachedPenScope(); 382using var rightPen = GetDarkModeColor(SystemColors.ButtonShadow).GetCachedPenScope(); 387using var leftPen = GetDarkModeColor(SystemColors.ButtonShadow).GetCachedPenScope(); 392using var rightPen = GetDarkModeColor(SystemColors.ControlDark).GetCachedPenScope(); 406using var foreColorPen = GetDarkModeColor(SystemColors.ControlDark).GetCachedPenScope(); 411using var darkModePen = GetDarkModeColor(SystemColors.ButtonShadow).GetCachedPenScope(); 434using var fillBrush = item.Pressed 469using var arrowBrush = GetDarkModeColor( 521using var darkColorBrush = GetDarkModeColor(SystemColors.ControlDark).GetCachedSolidBrushScope(); 522using var lightColorBrush = GetDarkModeColor(SystemColors.ControlLight).GetCachedSolidBrushScope(); 582using var marginColorBrush = GetDarkModeBrush(SystemColors.ControlLight); 650using var highLightBrush = GetDarkModeBrush(SystemColors.GrayText); 651using var shadowBrush = GetDarkModeBrush(SystemColors.ButtonShadow);
System\Windows\Forms\Controls\ToolStrips\ToolStripSystemRenderer.cs (4)
111using var backBrush = backColor.GetCachedSolidBrushScope(); 519using var pen = borderColor.GetCachedPenScope(); 644using var brush = SystemColors.Highlight.GetCachedSolidBrushScope(); 763using var foreColorPen = item.ForeColor.GetCachedPenScope();
System\Windows\Forms\Controls\ToolStrips\ToolStripTextBox.ToolStripTextBoxControl.cs (2)
257using var brush = innerBorderColor.GetCachedSolidBrushScope(); 264using var pen = outerBorderColor.GetCachedPenScope();
System\Windows\Forms\Controls\TreeView\TreeView.cs (2)
2839using var brush = BackColor.GetCachedSolidBrushScope(); 3139using var pen = VisualStyleInformation.TextControlBorder.GetCachedPenScope();
System\Windows\Forms\Layout\Containers\SplitContainer.cs (2)
1030using var brush = BackColor.GetCachedSolidBrushScope(); 1561using var solidBrush = BackColor.GetCachedSolidBrushScope();
System\Windows\Forms\Printing\PrintPreviewControl.cs (3)
346using var backBrush = backColor.GetCachedSolidBrushScope(); 601using var brush = brushColor.GetCachedSolidBrushScope(); 687using (var brush = ForeColor.GetCachedSolidBrushScope())
System\Windows\Forms\Rendering\ControlPaint.cs (15)
250using var brush = background.GetCachedSolidBrushScope(); 491using (var brush = backColor.GetCachedSolidBrushScope()) 1097using var darkPen = hls.Darker(1.0f).GetCachedPenScope(); 1102using var lightPen = hls.Lighter(1.0f).GetCachedPenScope(); 1111using var mediumPen = hls.Lighter(0.5f).GetCachedPenScope(); 1136using var lightPen = (stockColor ? SystemColors.ControlLightLight : hls.Lighter(1.0f)).GetCachedPenScope(); 1141using var darkPen = (stockColor ? SystemColors.ControlDarkDark : hls.Darker(1.0f)).GetCachedPenScope(); 1151using var topLeftPen = (!stockColor 1161using var bottomRightPen = (stockColor ? SystemColors.ControlDark : hls.Darker(0.5f)).GetCachedPenScope(); 1190using var pen = color.GetCachedPenScope(); 1957using var bright = GdiPlusCache.GetCachedPenScope(LightLight(backColor)); 1958using var dark = GdiPlusCache.GetCachedPenScope(Dark(backColor)); 2023using var lightBrush = LightLight(color).GetCachedSolidBrushScope(); 2027using var darkBrush = Dark(color).GetCachedSolidBrushScope(); 2085using var borderPen = VisualStyles.VisualStyleInformation.TextControlBorder.GetCachedPenScope();
System\Windows\Forms\Rendering\ControlPaint_ModernControlButtonRenderer.cs (3)
96using (var backgroundBrush = backgroundColor.GetCachedSolidBrushScope()) 112using var borderPen = borderColor.GetCachedPenScope(); 168using var contentBrush = contentColor.GetCachedSolidBrushScope();
System\Windows\Forms\Rendering\DrawItemEventArgs.cs (1)
125using var backBrush = BackColor.GetCachedSolidBrushScope();
System\Windows\Forms\Rendering\GdiCache.cs (1)
91public static FontCache.Scope GetHFONTScope(Font? font, FONT_QUALITY quality = FONT_QUALITY.DEFAULT_QUALITY)
System\Windows\Forms\Rendering\TextExtensions.cs (3)
52FontCache.Scope font, 104this FontCache.Scope font, 213FontCache.Scope font,
System\Windows\Forms\Rendering\TextRenderer.cs (4)
365using var hfont = GetFontOrHdcHFONT(font, fontQuality, hdc); 521using var hfont = GetFontOrHdcHFONT(font, FONT_QUALITY.DEFAULT_QUALITY, screen); 544using var hfont = GetFontOrHdcHFONT(font, quality, hdc); 658private static FontCache.Scope GetFontOrHdcHFONT(Font? font, FONT_QUALITY quality, HDC hdc)
System\Windows\Forms\ToolTip\DrawToolTipEventArgs.cs (1)
74using var backBrush = _backColor.GetCachedSolidBrushScope();
System.Windows.Forms.Design (4)
System\Drawing\Design\ColorEditor.ColorPalette.cs (2)
360using var brush = BackColor.GetCachedSolidBrushScope(); 416using var brush = color.GetCachedSolidBrushScope();
System\Drawing\Design\ColorEditor.cs (1)
51using var brush = color.GetCachedSolidBrushScope();
System\Drawing\Design\CursorEditor.CursorUI.cs (1)
66using var brushText = e.ForeColor.GetCachedSolidBrushScope();
System.Windows.Forms.Primitives (9)
System\Windows\Forms\GdiPlus\GdiPlusCache.cs (5)
27private static PenCache.Scope GetPenScope(Color color) 44private static SolidBrushCache.Scope GetSolidBrushScope(Color color) 73internal static PenCache.Scope GetCachedPenScope(this Color color) => GetPenScope(color); 76internal static PenCache.Scope GetCachedPenScope(this Color color, int width) 80internal static SolidBrushCache.Scope GetCachedSolidBrushScope(this Color color) => GetSolidBrushScope(color);
System\Windows\Forms\RefCountedCache.CacheEntry.cs (1)
64public Scope CreateScope() => new(this);
System\Windows\Forms\RefCountedCache.cs (2)
9/// Cache that ref counts handed-out objects via "scopes" <see cref="Scope"/>. 13/// type you would use here. <see cref="Scope"/> is implicitly convertible to this type.
System\Windows\Forms\RefCountedCache.Scope.cs (1)
60public static implicit operator TObject(in Scope scope)
System.Windows.Forms.Primitives.Tests (10)
System\Windows\Forms\RefCacheTests.cs (10)
14var firstScope = cache.GetEntry(1).CreateScope(); 17var secondScope = cache.GetEntry(1).CreateScope(); 26using var thirdScope = cache.GetEntry(1).CreateScope(); 37var firstScope = cache.GetEntry(1).CreateScope(); 38var secondScope = cache.GetEntry(2).CreateScope(); 39var thirdScope = cache.GetEntry(3).CreateScope(); 40var fourthScope = cache.GetEntry(4).CreateScope(); 47var fifthScope = cache.GetEntry(5).CreateScope(); 48var sixthScope = cache.GetEntry(5).CreateScope(); 69using var seventhScope = cache.GetEntry(7).CreateScope();
System.Windows.Forms.Tests (5)
Text\FontMetrics.cs (5)
27using var hfont = GdiCache.GetHFONTScope(font, FONT_QUALITY.CLEARTYPE_QUALITY); 46using var hfont = GdiCache.GetHFONTScope(font, FONT_QUALITY.CLEARTYPE_QUALITY); 67using var hfont = GdiCache.GetHFONTScope(font, FONT_QUALITY.CLEARTYPE_QUALITY); 85using var hfont = GdiCache.GetHFONTScope(font, FONT_QUALITY.CLEARTYPE_QUALITY); 142using var hfont = GdiCache.GetHFONTScope(font, FONT_QUALITY.CLEARTYPE_QUALITY);