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);
218 references to Scope
System.Windows.Forms (190)
System\Windows\Forms\Control.cs (1)
8204using 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 = GetBackgroundColor(state, isDefault).GetCachedSolidBrushScope();
System\Windows\Forms\Controls\Buttons\ButtonInternal\DarkMode\PopupButtonDarkModeRenderer.cs (1)
55using var brush = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\Buttons\ButtonInternal\DarkMode\SystemButtonDarkModeRenderer.cs (4)
44using var brush = backColor.GetCachedSolidBrushScope(); 67using var focusPen = Color.White.GetCachedPenScope(FocusedButtonBorderThickness); 179using var topLeftPen = topLeftColor.GetCachedPenScope(borderThickness); 183using 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)
818using (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)
5672using var brush = SystemColors.HotTrack.GetCachedSolidBrushScope(); 19226using var brush = BackgroundColor.GetCachedSolidBrushScope(); 19270using var brush = BackgroundColor.GetCachedSolidBrushScope(); 19316using var pen = VisualStyleInformation.TextControlBorder.GetCachedPenScope(); 19326using 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)
473using var textBrush = ForeColor.GetCachedSolidBrushScope(); 514using var hfont = GdiCache.GetHFONTScope(Font); 561using var boxPen = boxColor.GetCachedPenScope(); 669using 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)
1065using var hfont = GdiCache.GetHFONTScope(Font); 1123using var hfont = GdiCache.GetHFONTScope(Font); 1285using 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)
622using var brush = backColor.GetCachedSolidBrushScope(); 681using var brush = foreColor.GetCachedSolidBrushScope(); 740using var brush = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (1)
2328using 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)
6974using var pen = VisualStyleInformation.TextControlBorder.GetCachedPenScope();
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.cs (1)
1193using (var hfont = GdiCache.GetHFONTScope(Font))
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.cs (1)
2891using 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)
1536using var backBrush = backColor.GetCachedSolidBrushScope(); 1546using var linePen = ownerGrid.LineColor.GetCachedPenScope(); 1559using var stripeBrush = ownerGrid.LineColor.GetCachedSolidBrushScope(); 1564using var focusBrush = ownerGrid.SelectedItemWithFocusBackColor.GetCachedSolidBrushScope(); 1593using var textBrush = textColor.GetCachedSolidBrushScope(); 1673using var brush = textColor.GetCachedSolidBrushScope(); 1744using var brush = BackgroundColor.GetCachedSolidBrushScope(); 1749using var pen = penColor.GetCachedPenScope(); 1832using var backBrush = backColor.GetCachedSolidBrushScope();
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (5)
2365using var brush = color.GetCachedSolidBrushScope(); 3316using var splitterPen = OwnerGrid.LineColor.GetCachedPenScope(SplitterWidth); 3320using var linePen = g.FindNearestColor(OwnerGrid.LineColor).GetCachedPenScope(); 3367using var backBrush = BackColor.GetCachedSolidBrushScope(); 3372using 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)
827using 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)
301using var brush = Application.IsDarkModeEnabled ? 373using var pen = ColorTable.ButtonSelectedBorder.GetCachedPenScope(); 387using var pen = ColorTable.ButtonSelectedBorder.GetCachedPenScope(); 420using (var pen = ColorTable.ToolStripBorder.GetCachedPenScope()) 523using var gripLightBrush = ColorTable.GripLight.GetCachedSolidBrushScope(); 531using var controlTextBrush = SystemColors.ControlText.GetCachedSolidBrushScope(); 587using var pen = borderColor.GetCachedPenScope(); 606using var brush = item.BackColor.GetCachedSolidBrushScope(); 644using var pen = borderColor.GetCachedPenScope(); 657using var brush = item.BackColor.GetCachedSolidBrushScope(); 662using var pen = ColorTable.MenuItemBorder.GetCachedPenScope(); 931using (var brush = overflowBottomLeftShadow.GetCachedSolidBrushScope()) 937using (var brush = overflowTopShadow.GetCachedSolidBrushScope()) 987using (var brush = middleColor.GetCachedSolidBrushScope()) 1058using var brush = fill.GetCachedSolidBrushScope(); 1061using var pen = ColorTable.ButtonSelectedBorder.GetCachedPenScope(); 1095using var pen = ColorTable.MenuBorder.GetCachedPenScope(); 1133using var brush = beginColor.GetCachedSolidBrushScope(); 1185using var brush = ColorTable.ToolStripDropDownBackground.GetCachedSolidBrushScope(); 1197using (var pen = ColorTable.MenuBorder.GetCachedPenScope()) 1205using var brush = ColorTable.ToolStripDropDownBackground.GetCachedSolidBrushScope(); 1269using var pen = overflowBottomLeftShadow.GetCachedPenScope(); 1294using (var brush = overflowTopShadow.GetCachedSolidBrushScope()) 1317using (var brush = overflowButtonGradientBegin.GetCachedSolidBrushScope()) 1351using (var brush = ColorTable.ToolStripGradientMiddle.GetCachedSolidBrushScope()) 1385using (var brush = ColorTable.ToolStripGradientEnd.GetCachedSolidBrushScope()) 1423using var brush = ColorTable.ButtonSelectedHighlight.GetCachedSolidBrushScope(); 1447using var brush = ColorTable.ButtonCheckedHighlight.GetCachedSolidBrushScope(); 1495using var foreColorPen = ColorTable.SeparatorDark.GetCachedPenScope(); 1496using var highlightColorPen = ColorTable.SeparatorLight.GetCachedPenScope(); 1558using var brush = ColorTable.ButtonPressedHighlight.GetCachedSolidBrushScope(); 1589using var brush = item.BackColor.GetCachedSolidBrushScope(); 1595using var pen = ColorTable.ButtonSelectedBorder.GetCachedPenScope();
System\Windows\Forms\Controls\ToolStrips\ToolStripRenderer.cs (1)
695using 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)
113using var backBrush = backColor.GetCachedSolidBrushScope(); 521using var pen = borderColor.GetCachedPenScope(); 646using var brush = SystemColors.Highlight.GetCachedSolidBrushScope(); 765using 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)
2852using var brush = BackColor.GetCachedSolidBrushScope(); 3152using 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)
222using var brush = background.GetCachedSolidBrushScope(); 456using (var brush = backColor.GetCachedSolidBrushScope()) 1062using var darkPen = hls.Darker(1.0f).GetCachedPenScope(); 1067using var lightPen = hls.Lighter(1.0f).GetCachedPenScope(); 1076using var mediumPen = hls.Lighter(0.5f).GetCachedPenScope(); 1101using var lightPen = (stockColor ? SystemColors.ControlLightLight : hls.Lighter(1.0f)).GetCachedPenScope(); 1106using var darkPen = (stockColor ? SystemColors.ControlDarkDark : hls.Darker(1.0f)).GetCachedPenScope(); 1116using var topLeftPen = (!stockColor 1126using var bottomRightPen = (stockColor ? SystemColors.ControlDark : hls.Darker(0.5f)).GetCachedPenScope(); 1155using var pen = color.GetCachedPenScope(); 1893using var bright = GdiPlusCache.GetCachedPenScope(LightLight(backColor)); 1894using var dark = GdiPlusCache.GetCachedPenScope(Dark(backColor)); 1959using var lightBrush = LightLight(color).GetCachedSolidBrushScope(); 1963using var darkBrush = Dark(color).GetCachedSolidBrushScope(); 2021using var borderPen = VisualStyles.VisualStyleInformation.TextControlBorder.GetCachedPenScope();
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);