5 implementations of IDeviceContext
System.Drawing.Common (1)
Special\NotSupported.cs (1)
431public sealed partial class Graphics : System.MarshalByRefObject, System.Drawing.IDeviceContext, System.IDisposable
System.Windows.Forms (2)
System\Windows\Forms\Rendering\DrawItemEventArgs.cs (1)
14public class DrawItemEventArgs : EventArgs, IDisposable, IDeviceContext, IGraphicsHdcProvider, IHdcContext
System\Windows\Forms\Rendering\PaintEventArgs.cs (1)
18public partial class PaintEventArgs : EventArgs, IDisposable, IDeviceContext, IGraphicsHdcProvider, IHdcContext
System.Windows.Forms.Primitives.TestUtilities (1)
HdcDeviceContextAdapter.cs (1)
12internal class HdcDeviceContextAdapter : IDeviceContext
System.Windows.Forms.Tests (1)
System\Windows\Forms\TextRendererTests.cs (1)
659private class MockDC : IDeviceContext
112 references to IDeviceContext
System.Drawing (1)
System.Drawing.cs (1)
64[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.IDeviceContext))]
System.Windows.Forms (97)
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.ColorOptions.cs (2)
14private readonly IDeviceContext _deviceContext; 19internal ColorOptions(IDeviceContext deviceContext, Color foreColor, Color backColor)
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (12)
103protected void Draw3DBorder(IDeviceContext deviceContext, Rectangle bounds, ColorData colors, bool raised) 129private void Draw3DBorderHighContrastRaised(IDeviceContext deviceContext, ref Rectangle bounds, ColorData colors) 187private static void Draw3DBorderNormal(IDeviceContext deviceContext, ref Rectangle bounds, ColorData colors) 232private void Draw3DBorderRaised(IDeviceContext deviceContext, ref Rectangle bounds, ColorData colors) 294protected internal static void Draw3DLiteBorder(IDeviceContext deviceContext, Rectangle r, ColorData colors, bool up) 356internal static void DrawFlatFocus(IDeviceContext deviceContext, Rectangle r, Color color) 423internal static void DrawDefaultBorder(IDeviceContext deviceContext, Rectangle r, Color color, bool isDefault) 632IDeviceContext deviceContext, 640private ColorOptions CommonRender(IDeviceContext deviceContext) => 646protected ColorOptions PaintRender(IDeviceContext deviceContext) => CommonRender(deviceContext); 651protected ColorOptions PaintFlatRender(IDeviceContext deviceContext) => CommonRender(deviceContext); 656protected ColorOptions PaintPopupRender(IDeviceContext deviceContext) => CommonRender(deviceContext);
System\Windows\Forms\Controls\Buttons\ButtonInternal\CheckBoxBaseAdapter.cs (1)
85IDeviceContext deviceContext,
System\Windows\Forms\Controls\Buttons\ButtonRenderer.cs (7)
54=> DrawParentBackground((IDeviceContext)g, bounds, childControl); 56internal static void DrawParentBackground(IDeviceContext dc, Rectangle bounds, Control childControl) 67DrawButton((IDeviceContext)g, bounds, state); 69internal static void DrawButton(IDeviceContext deviceContext, Rectangle bounds, PushButtonState state) 87IDeviceContext deviceContext, 230=> DrawButton((IDeviceContext)g, bounds, buttonText, font, flags, image, imageBounds, focused, state); 233IDeviceContext deviceContext,
System\Windows\Forms\Controls\Buttons\CheckBoxRenderer.cs (3)
71IDeviceContext deviceContext, 230public static Size GetGlyphSize(Graphics g, CheckBoxState state) => GetGlyphSize((IDeviceContext)g, state); 232internal static Size GetGlyphSize(IDeviceContext deviceContext, CheckBoxState state, HWND hwnd = default)
System\Windows\Forms\Controls\GroupBox\GroupBoxRenderer.cs (6)
102=> DrawGroupBox((IDeviceContext)g, bounds, groupBoxText, font, flags, state); 105IDeviceContext deviceContext, 133=> DrawGroupBox((IDeviceContext)g, bounds, groupBoxText, font, textColor, flags, state); 136IDeviceContext deviceContext, 167IDeviceContext deviceContext, 273IDeviceContext deviceContext,
System\Windows\Forms\Controls\TabControl\TabRenderer.cs (2)
143=> DrawTabPage((IDeviceContext)g, bounds); 145internal static void DrawTabPage(IDeviceContext deviceContext, Rectangle bounds)
System\Windows\Forms\Rendering\ControlPaint.cs (5)
558(IDeviceContext)graphics, 567IDeviceContext deviceContext, 1141IDeviceContext context, 1913IDeviceContext deviceContext, 1977IDeviceContext dc,
System\Windows\Forms\Rendering\DrawItemEventArgs.cs (4)
161IntPtr IDeviceContext.GetHdc() => Graphics?.GetHdc() ?? IntPtr.Zero; 162HDC IHdcContext.GetHdc() => (HDC)((IDeviceContext)this).GetHdc(); 163void IDeviceContext.ReleaseHdc() => Graphics?.ReleaseHdc(); 164void IHdcContext.ReleaseHdc() => ((IDeviceContext)this).ReleaseHdc();
System\Windows\Forms\Rendering\PaintEventArgs.cs (4)
134IntPtr IDeviceContext.GetHdc() => Graphics?.GetHdc() ?? IntPtr.Zero; 135HDC IHdcContext.GetHdc() => (HDC)((IDeviceContext)this).GetHdc(); 136void IDeviceContext.ReleaseHdc() => Graphics?.ReleaseHdc(); 137void IHdcContext.ReleaseHdc() => ((IDeviceContext)this).ReleaseHdc();
System\Windows\Forms\Rendering\TextRenderer.cs (32)
25public static void DrawText(IDeviceContext dc, string? text, Font? font, Point pt, Color foreColor) 37public static void DrawText(IDeviceContext dc, ReadOnlySpan<char> text, Font font, Point pt, Color foreColor) 41IDeviceContext dc, 60IDeviceContext dc, 69IDeviceContext dc, 92IDeviceContext dc, 108IDeviceContext dc, 133IDeviceContext dc, 149public static void DrawText(IDeviceContext dc, string? text, Font? font, Rectangle bounds, Color foreColor) 162IDeviceContext dc, 170IDeviceContext dc, 190IDeviceContext dc, 199IDeviceContext dc, 222IDeviceContext dc, 238IDeviceContext dc, 263IDeviceContext dc, 280IDeviceContext dc, 290IDeviceContext dc, 392/// <see cref="DrawText(IDeviceContext, ReadOnlySpan{char}, Font?, Rectangle, Color, TextFormatFlags)"/> 396/// versions of <see cref="DrawText(IDeviceContext, ReadOnlySpan{char}, Font, Point, Color)"/> and 397/// <see cref="MeasureText(IDeviceContext, ReadOnlySpan{char}, Font?)"/> that take a Size and 399/// <see cref="MeasureText(IDeviceContext, string?, Font?, Size, TextFormatFlags)"/>. 442public static Size MeasureText(IDeviceContext dc, string? text, Font? font) 456public static Size MeasureText(IDeviceContext dc, ReadOnlySpan<char> text, Font? font) 459public static Size MeasureText(IDeviceContext dc, string? text, Font? font, Size proposedSize) 475public static Size MeasureText(IDeviceContext dc, ReadOnlySpan<char> text, Font? font, Size proposedSize) 479IDeviceContext dc, 504IDeviceContext dc, 527IDeviceContext dc, 566internal static FONT_QUALITY FontQualityFromTextRenderingHint(IDeviceContext? deviceContext) 584/// Returns what <see cref="FontQualityFromTextRenderingHint(IDeviceContext?)"/> would return in an 602internal static ApplyGraphicsProperties GetApplyStateFlags(IDeviceContext deviceContext, TextFormatFlags textFormatFlags)
System\Windows\Forms\VisualStyles\VisualStyleRenderer.cs (19)
211public void DrawBackground(IDeviceContext dc, Rectangle bounds) 240public void DrawBackground(IDeviceContext dc, Rectangle bounds, Rectangle clipRectangle) 267public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) 335public void DrawParentBackground(IDeviceContext dc, Rectangle bounds, Control childControl) 355public void DrawText(IDeviceContext dc, Rectangle bounds, string? textToDraw) 363public void DrawText(IDeviceContext dc, Rectangle bounds, string? textToDraw, bool drawDisabled) 371public void DrawText(IDeviceContext dc, Rectangle bounds, string? textToDraw, bool drawDisabled, TextFormatFlags flags) 405public Rectangle GetBackgroundContentRectangle(IDeviceContext dc, Rectangle bounds) 427public Rectangle GetBackgroundExtent(IDeviceContext dc, Rectangle contentBounds) 446public unsafe Region? GetBackgroundRegion(IDeviceContext dc, Rectangle bounds) 530public Font? GetFont(IDeviceContext dc, FontProperty prop) 571public Size GetPartSize(IDeviceContext dc, ThemeSizeType type) 598public unsafe Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type) 625public unsafe Padding GetMargins(IDeviceContext dc, MarginProperty prop) 658public unsafe Rectangle GetTextExtent(IDeviceContext dc, string textToDraw, TextFormatFlags flags) 681public unsafe Rectangle GetTextExtent(IDeviceContext dc, Rectangle bounds, string textToDraw, TextFormatFlags flags) 704public TextMetrics GetTextMetrics(IDeviceContext dc) 716public HitTestCode HitTestBackground(IDeviceContext dc, Rectangle backgroundRectangle, Point pt, HitTestOptions options) 750public HitTestCode HitTestBackground(IDeviceContext dc, Rectangle backgroundRectangle, IntPtr hRgn, Point pt, HitTestOptions options)
System.Windows.Forms.Design (1)
System\ComponentModel\Design\CollectionEditor.SplitButton.cs (1)
242private static void PaintArrow(IDeviceContext deviceContext, Rectangle dropDownRect)
System.Windows.Forms.Primitives (4)
System\Windows\Forms\DeviceContextExtensions.cs (2)
173internal static Graphics? TryGetGraphics(this IDeviceContext deviceContext, bool create = false) => deviceContext switch 181this IDeviceContext deviceContext,
System\Windows\Forms\DeviceContextExtensions.IDeviceContextAdapter.cs (2)
12private readonly IDeviceContext _deviceContext; 13public IDeviceContextAdapter(IDeviceContext deviceContext) => _deviceContext = deviceContext;
System.Windows.Forms.Primitives.TestUtilities (1)
HdcDeviceContextAdapter.cs (1)
9/// Simple adapter for passing <see cref="HDC"/> as <see cref="IDeviceContext"/>. Does not manage HDC
System.Windows.Forms.Tests (8)
System\Windows\Forms\TextRendererTests.cs (8)
313Mock<IDeviceContext> mockDeviceContext = new(MockBehavior.Strict); 538Mock<IDeviceContext> mockDeviceContext = new(MockBehavior.Strict); 571public unsafe void TextRenderer_DrawText_DefaultBackground_RendersTransparent(Func<IDeviceContext, Action> func) 587public static TheoryData<Func<IDeviceContext, Action>> TextRenderer_DrawText_DefaultBackground_RendersTransparent_TestData 590(IDeviceContext context) => () => 593(IDeviceContext context) => () => 596(IDeviceContext context) => () => 599(IDeviceContext context) => () =>