5 instantiations of HDC
System.Windows.Forms.Primitives.Tests (4)
System\Windows\Forms\DeviceContextHdcScopeTests.cs (1)
251
HDC mockHdc =
new
(1234);
System\Windows\Forms\Internals\ArgumentValidationTests.cs (3)
91
HDC param =
new
(IntPtr.Zero);
99
HDC param =
new
(new IntPtr(24));
106
HDC param =
new
(IntPtr.Zero);
System.Windows.Forms.Tests (1)
System\Windows\Forms\CheckBoxBaseAdapterTests.cs (1)
247
new
HDC
(hdcPtr),
334 references to HDC
System.Drawing.Common (59)
System\Drawing\BufferedGraphics.cs (2)
92
(
HDC
)refTargetDC.Handle,
97
(
HDC
)sourceDC,
System\Drawing\BufferedGraphicsContext.cs (13)
19
private
HDC
_compatDC;
77
return AllocBufferInTempManager(targetGraphics,
HDC
.Null, targetRectangle);
80
return AllocBuffer(targetGraphics,
HDC
.Null, targetRectangle);
90
return AllocBufferInTempManager(null, (
HDC
)targetDC, targetRectangle);
93
return AllocBuffer(null, (
HDC
)targetDC, targetRectangle);
99
private BufferedGraphics AllocBuffer(Graphics? targetGraphics,
HDC
targetDC, Rectangle targetRectangle)
121
surface = CreateBuffer((
HDC
)destDc, targetRectangle.Width, targetRectangle.Height);
148
private static BufferedGraphics AllocBufferInTempManager(Graphics? targetGraphics,
HDC
targetDC, Rectangle targetRectangle)
203
private bool FillBitmapInfo(
HDC
hdc, HPALETTE hpalette, BITMAPINFO* bitmapInfo)
260
private bool FillColorTable(
HDC
hdc, HPALETTE hpalette, BITMAPINFO* bitmapInfo)
304
private Graphics CreateBuffer(
HDC
src, int width, int height)
352
private HBITMAP CreateCompatibleDIB(
HDC
hdc, HPALETTE hpalette, int ulWidth, int ulHeight)
433
_compatDC =
HDC
.Null;
System\Drawing\Font.cs (2)
590
status = PInvokeGdiPlus.GdipCreateFontFromLogfont((
HDC
)hdc, (LOGFONTW*)lf, &font);
657
Status status = PInvokeGdiPlus.GdipCreateFontFromDC((
HDC
)hdc, &font);
System\Drawing\Graphics.cs (14)
46
private
HDC
_nativeHdc;
91
Gdip.CheckStatus(PInvokeGdiPlus.GdipCreateFromHDC((
HDC
)hdc, &nativeGraphics));
102
Gdip.CheckStatus(PInvokeGdiPlus.GdipCreateFromHDC2((
HDC
)hdc, (HANDLE)hdevice, &nativeGraphics));
145
CheckStatus(!Gdip.Initialized ? Status.Ok : PInvokeGdiPlus.GdipReleaseDC(NativeGraphics, (
HDC
)hdc));
146
_nativeHdc =
HDC
.Null;
488
HDC
IHdcContext.GetHdc() => (
HDC
)GetHdc();
492
HDC
hdc;
2743
HDC
targetDC = (
HDC
)GetHdc();
3287
(
HDC
hdc, int saveState) IGraphicsContextInfo.GetHdc(ApplyGraphicsProperties apply, bool alwaysSaveState)
3293
HDC
hdc =
HDC
.Null;
3314
hdc = (
HDC
)GetHdc();
System\Drawing\Icon.cs (1)
272
private void DrawIcon(
HDC
hdc, Rectangle imageRect, Rectangle targetRect, bool stretch)
System\Drawing\Imaging\Metafile.cs (9)
127
(
HDC
)referenceHdc,
223
(
HDC
)referenceHdc,
361
(
HDC
)referenceHdc,
385
(
HDC
)referenceHdc,
410
(
HDC
)referenceHdc,
436
(
HDC
)referenceHdc,
460
(
HDC
)referenceHdc,
485
(
HDC
)referenceHdc,
510
(
HDC
)referenceHdc,
System\Drawing\Printing\DefaultPrintController.cs (5)
12
public unsafe class StandardPrintController : PrintController, IHandle<
HDC
>
17
HDC
IHandle<
HDC
>.Handle => _hdc?.Handle ??
HDC
.Null;
81
HDC
result = PInvoke.ResetDCW(_hdc, devmode);
System\Drawing\Printing\PreviewPrintController.cs (2)
58
HDC
hdc = _hdc ??
HDC
.Null;
System\Drawing\Printing\PrinterSettings.cs (1)
341
private static bool IsDirectPrintingSupported(
HDC
hdc, ImageFormat imageFormat, out int escapeFunction)
Windows\Win32\PInvoke.AbortDoc.cs (2)
8
/// <inheritdoc cref="AbortDoc(
HDC
)"/>
9
internal static unsafe int AbortDoc<T>(T hdc) where T : IHandle<
HDC
>
Windows\Win32\PInvoke.EndDoc.cs (2)
8
/// <inheritdoc cref="EndDoc(
HDC
)"/>
9
internal static unsafe int EndDoc<T>(T hdc) where T : IHandle<
HDC
>
Windows\Win32\PInvoke.EndPage.cs (2)
8
/// <inheritdoc cref="EndPage(
HDC
)"/>
9
internal static unsafe int EndPage<T>(T hdc) where T : IHandle<
HDC
>
Windows\Win32\PInvoke.StartDoc.cs (2)
8
/// <inheritdoc cref="StartDoc(
HDC
, DOCINFOW*)"/>
9
internal static unsafe int StartDoc<T>(T hdc, in DOCINFOW lpdi) where T : IHandle<
HDC
>
Windows\Win32\PInvoke.StartPage.cs (2)
8
/// <inheritdoc cref="StartPage(
HDC
)"/>
9
internal static unsafe int StartPage<T>(T hdc) where T : IHandle<
HDC
>
System.Drawing.Common.Tests (5)
Helpers.cs (1)
128
internal static Rectangle GetWindowDCRect(
HDC
hdc) => GetHWndRect(PInvokeCore.WindowFromDC(hdc));
System\Drawing\ImageTests.cs (2)
673
HDC
hdc = PInvokeCore.CreateEnhMetaFile(
HDC
.Null, default, null, default(PCWSTR));
System\Drawing\Imaging\MetafileTests.cs (2)
1025
HDC
hdc = PInvokeCore.CreateEnhMetaFile(
HDC
.Null, default, null, default(PCWSTR));
System.Private.Windows.Core (71)
System\ArgumentValidation.cs (1)
47
internal static void ThrowIfNull(
HDC
argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
Windows\Win32\Foundation\WPARAM.cs (3)
16
public static explicit operator
HDC
(WPARAM value) => (
HDC
)(nint)value.Value;
17
public static explicit operator WPARAM(
HDC
value) => new((nuint)value.Value);
Windows\Win32\Graphics\Gdi\BeginPaintScope.cs (2)
25
public
HDC
HDC { get; }
35
public static implicit operator
HDC
(in BeginPaintScope scope) => scope.HDC;
Windows\Win32\Graphics\Gdi\CreateBitmapScope.cs (3)
31
/// Creates a bitmap compatible with the given <see cref="
HDC
"/> via
32
/// <see cref="PInvokeCore.CreateCompatibleBitmap(
HDC
, int, int)"/>
34
public CreateBitmapScope(
HDC
hdc, int cx, int cy) => HBITMAP = PInvokeCore.CreateCompatibleBitmap(hdc, cx, cy);
Windows\Win32\Graphics\Gdi\CreateDcScope.cs (4)
22
public
HDC
HDC { get; }
25
/// Creates a compatible HDC for <paramref name="hdc"/> using <see cref="PInvokeCore.CreateCompatibleDC(
HDC
)"/>.
32
public CreateDcScope(
HDC
hdc)
52
public static implicit operator
HDC
(in CreateDcScope scope) => scope.HDC;
Windows\Win32\Graphics\Gdi\GetDcScope.cs (5)
7
/// Helper to scope lifetime of an <see cref="Gdi.
HDC
"/> retrieved via <see cref="PInvokeCore.GetDC(HWND)"/> and
8
/// <see cref="PInvokeCore.GetDCEx(HWND, HRGN, GET_DCX_FLAGS)"/>. Releases the <see cref="Gdi.
HDC
"/> (if any)
19
public
HDC
HDC { get; }
29
/// Creates a <see cref="Gdi.
HDC
"/> using <see cref="PInvokeCore.GetDCEx(HWND, HRGN, GET_DCX_FLAGS)"/>.
60
public static implicit operator
HDC
(in GetDcScope scope) => scope.HDC;
Windows\Win32\Graphics\Gdi\HDC.cs (4)
10
internal readonly partial struct HDC : IHandle<
HDC
>
12
HDC
IHandle<
HDC
>.Handle => this;
13
object? IHandle<
HDC
>.Wrapper => null;
Windows\Win32\Graphics\Gdi\HdcHandle.cs (4)
7
/// Used when you must keep a handle to an <see cref="
HDC
"/> in a field. Avoid keeping HDC handles in fields
10
internal sealed class HdcHandle : IDisposable, IHandle<
HDC
>
24
public
HDC
Handle { get; private set; }
26
public static implicit operator
HDC
(in HdcHandle handle) => handle.Handle;
Windows\Win32\Graphics\Gdi\HGDIOBJ.cs (1)
8
public static implicit operator HGDIOBJ(
HDC
value) => (HGDIOBJ)value.Value;
Windows\Win32\Graphics\Gdi\IHDCContext.cs (1)
8
HDC
GetHdc();
Windows\Win32\Graphics\Gdi\RegionScope.cs (2)
38
/// Creates a clipping region copy via <see cref="PInvokeCore.GetClipRgn(
HDC
, HRGN)"/> for the given device context.
41
public RegionScope(
HDC
hdc)
Windows\Win32\Graphics\Gdi\SaveDcScope.cs (3)
25
public
HDC
HDC { get; }
29
/// Saves the device context state using <see cref="PInvokeCore.SaveDC(
HDC
)"/>.
32
public SaveDcScope(
HDC
hdc)
Windows\Win32\Graphics\Gdi\SelectObjectScope.cs (5)
7
/// Helper to scope selecting a GDI object into an <see cref="
HDC
"/>. Restores the original
8
/// object into the <see cref="
HDC
"/> when disposed.
22
private readonly
HDC
_hdc;
27
/// <see cref="PInvokeCore.SelectObject(
HDC
, HGDIOBJ)"/>.
29
public SelectObjectScope(
HDC
hdc, HGDIOBJ @object)
Windows\Win32\Graphics\Gdi\SelectPaletteScope.cs (2)
21
public
HDC
HDC { get; }
24
public SelectPaletteScope(
HDC
hdc, HPALETTE hpalette, bool forceBackground, bool realizePalette)
Windows\Win32\Graphics\Gdi\SetBackgroundColorScope.cs (3)
19
private readonly
HDC
_hdc;
23
/// <see cref="PInvokeCore.SetBkColor(
HDC
, COLORREF)"/>.
25
public SetBackgroundColorScope(
HDC
hdc, COLORREF color)
Windows\Win32\Graphics\Gdi\SetBkModeScope.cs (2)
23
private readonly
HDC
_hdc;
28
public SetBkModeScope(
HDC
hdc, BACKGROUND_MODE bkmode)
Windows\Win32\Graphics\Gdi\SetMapModeScope.cs (3)
23
private readonly
HDC
_hdc;
27
/// <see cref="PInvokeCore.SetMapMode(
HDC
, HDC_MAP_MODE)"/>.
29
public SetMapModeScope(
HDC
hdc, HDC_MAP_MODE mapMode)
Windows\Win32\Graphics\Gdi\SetRop2Scope.cs (3)
23
private readonly
HDC
_hdc;
26
/// Selects <paramref name="rop2"/> into the given <paramref name="hdc"/> using <see cref="PInvokeCore.SetROP2(
HDC
, R2_MODE)"/>.
28
public SetRop2Scope(
HDC
hdc, R2_MODE rop2)
Windows\Win32\Graphics\Gdi\SetTextAlignmentScope.cs (3)
23
private readonly
HDC
_hdc;
27
/// using <see cref="PInvokeCore.SetTextAlign(
HDC
, TEXT_ALIGN_OPTIONS)"/>.
29
public SetTextAlignmentScope(
HDC
hdc, TEXT_ALIGN_OPTIONS ta)
Windows\Win32\Graphics\Gdi\SetTextColorScope.cs (3)
23
private readonly
HDC
_hdc;
27
/// <see cref="PInvokeCore.SetTextColor(
HDC
, COLORREF)"/>.
29
public SetTextColorScope(
HDC
hdc, COLORREF color)
Windows\Win32\PInvokeCore.BitBlt.cs (8)
8
/// <inheritdoc cref="BitBlt(
HDC
, int, int, int, int,
HDC
, int, int, ROP_CODE)"/>
15
HDC
hdcSrc,
18
ROP_CODE rop) where T : IHandle<
HDC
>
34
/// <inheritdoc cref="BitBlt(
HDC
, int, int, int, int,
HDC
, int, int, ROP_CODE)"/>
36
HDC
hdc,
44
ROP_CODE rop) where T : IHandle<
HDC
>
Windows\Win32\PInvokeCore.DrawIcon.cs (1)
8
public static BOOL DrawIcon<T>(
HDC
hDC, int x, int y, T hIcon)
Windows\Win32\PInvokeCore.DrawIconEx.cs (2)
8
/// <inheritdoc cref="DrawIconEx(
HDC
, int, int, HICON, int, int, uint, HBRUSH, DI_FLAGS)"/>
10
HDC
hDC,
Windows\Win32\PInvokeCore.EnumDisplayMonitors.cs (2)
11
public delegate bool EnumDisplayMonitorsCallback(HMONITOR monitor,
HDC
hdc);
27
private static BOOL EnumDisplayMonitorsNativeCallback(HMONITOR monitor,
HDC
hdc, RECT* lprcMonitor, LPARAM lParam)
Windows\Win32\UI\Controls\Dialogs\PRINTDLGEXW.cs (1)
117
public
HDC
hDC;
System.Private.Windows.GdiPlus (9)
System\Drawing\ApplyGraphicsProperties.cs (1)
9
/// Enumeration defining the different Graphics properties to apply to an <see cref="
HDC
"/> when creating it
System\Drawing\IGraphicsContextInfo.cs (1)
10
(
HDC
hdc, int saveState) GetHdc(ApplyGraphicsProperties apply, bool alwaysSaveState);
Windows\Win32\Graphics\Gdi\DeviceContextHdcScope.cs (4)
30
public
HDC
HDC { get; }
39
/// When a <see cref="T:System.Drawing.Graphics"/> object is created from a <see cref="Gdi.
HDC
"/> the clipping region and
40
/// the viewport origin are applied (<see cref="PInvokeCore.GetViewportExtEx(
HDC
, SIZE*)"/>). The clipping
158
public static implicit operator
HDC
(in DeviceContextHdcScope scope) => scope.HDC;
Windows\Win32\Graphics\Gdi\HdcExtensions.cs (1)
20
where T : IHandle<
HDC
>
Windows\Win32\Graphics\Gdi\IGraphicsHdcProvider.cs (2)
27
/// Gets the <see cref="
HDC
"/>, if the object was created from one.
29
HDC
GetHdc();
System.Windows.Forms (130)
System\Windows\Forms\ActiveX\AxHost.cs (1)
3057
internal override HBRUSH InitializeDCForWmCtlColor(
HDC
dc, MessageId msg)
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (4)
406
/// <inheritdoc cref="IViewObject.Interface.Draw(DVASPECT, int, void*, DVTARGETDEVICE*,
HDC
,
HDC
, RECTL*, RECTL*, nint, nuint)"/>
412
HDC
hdcTargetDev,
413
HDC
hdcDraw,
System\Windows\Forms\ActiveX\Control_ActiveXControlInterfaces.cs (12)
513
/// <inheritdoc cref="IViewObject.Draw(DVASPECT, int, void*, DVTARGETDEVICE*,
HDC
,
HDC
, RECTL*, RECTL*, nint, nuint)"/>
519
HDC
hdcTargetDev,
520
HDC
hdcDraw,
543
/// <inheritdoc cref="IViewObject.GetColorSet(DVASPECT, int, void*, DVTARGETDEVICE*,
HDC
, LOGPALETTE**)"/>
549
HDC
hicTargetDev,
569
/// <inheritdoc cref="IViewObject.Draw(DVASPECT, int, void*, DVTARGETDEVICE*,
HDC
,
HDC
, RECTL*, RECTL*, nint, nuint)"/>
575
HDC
hdcTargetDev,
576
HDC
hdcDraw,
593
/// <inheritdoc cref="IViewObject.GetColorSet(DVASPECT, int, void*, DVTARGETDEVICE*,
HDC
, LOGPALETTE**)"/>
599
HDC
hdcTargetDev,
System\Windows\Forms\Control.cs (11)
5873
internal virtual HBRUSH InitializeDCForWmCtlColor(
HDC
dc, MessageId msg)
8790
private unsafe void PrintToMetaFile(
HDC
hDC, IntPtr lParam)
8823
private protected virtual void PrintToMetaFileRecursive(
HDC
hDC, IntPtr lParam, Rectangle bounds)
8856
private void PrintToMetaFile_SendPrintMessage(
HDC
hDC, nint lParam)
11250
m.ResultInternal = (LRESULT)(nint)control.InitializeDCForWmCtlColor((
HDC
)(nint)m.WParamInternal, m.MsgInternal);
11278
HDC
dc = (
HDC
)(nint)m.WParamInternal;
11839
HDC
dc = (
HDC
)(nint)m.WParamInternal;
11951
HDC
hdc = (
HDC
)(nint)m.WParamInternal;
System\Windows\Forms\Control.MetafileDCWrapper.cs (5)
25
private readonly
HDC
_hMetafileDC;
28
internal unsafe MetafileDCWrapper(
HDC
hOriginalDC, Size size)
83
internal
HDC
HDC { get; private set; }
86
private unsafe bool DICopy(
HDC
hdcDest,
HDC
hdcSrc, RECT rect, bool bStretch)
System\Windows\Forms\Control.PrintPaintEventArgs.cs (1)
14
internal PrintPaintEventArgs(Message m,
HDC
dc, Rectangle clipRect)
System\Windows\Forms\Controls\Buttons\ButtonInternal\CheckBoxBaseAdapter.cs (1)
213
internal static Rectangle DrawPopupBorder(
HDC
hdc, Rectangle r, ColorData colors)
System\Windows\Forms\Controls\Buttons\ButtonInternal\RadioButtonBaseAdapter.cs (1)
97
private static void DrawAndFillEllipse(
HDC
hdc, HPEN borderPen, HBRUSH fieldBrush, Rectangle bounds)
System\Windows\Forms\Controls\Buttons\CheckBoxRenderer.cs (1)
243
internal static Size GetGlyphSize(
HDC
hdc, CheckBoxState state, HWND hwnd)
System\Windows\Forms\Controls\Buttons\RadioButtonRenderer.cs (2)
54
HDC
hdc,
257
internal static Size GetGlyphSize(
HDC
hdc, RadioButtonState state, HWND hwnd)
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (11)
2001
internal override HBRUSH InitializeDCForWmCtlColor(
HDC
dc, MessageId msg)
3451
HDC
hdc = (
HDC
)m.WParamInternal;
3682
(
HDC
)m.WParamInternal,
3686
(
HDC
)m.WParamInternal,
3700
(
HDC
)m.WParamInternal,
3704
(
HDC
)m.WParamInternal,
3716
m.ResultInternal = (LRESULT)(nint)InitializeDCForWmCtlColor((
HDC
)(nint)m.WParamInternal, m.MsgInternal);
3789
HDC
dc = useBeginPaint ? paintScope! : (
HDC
)m.WParamInternal;
3846
using Graphics g = Graphics.FromHdcInternal((
HDC
)m.WParamInternal);
System\Windows\Forms\Controls\ComboBox\ComboBoxRenderer.cs (1)
115
internal static void DrawDropDownButtonForHandle(
HDC
hdc, Rectangle bounds, ComboBoxState state, HWND hwnd)
System\Windows\Forms\Controls\GroupBox\GroupBox.cs (2)
667
using Graphics graphics = Graphics.FromHdcInternal((
HDC
)m.WParamInternal);
674
PInvoke.FillRect((
HDC
)m.WParamInternal, rect, hbrush);
System\Windows\Forms\Controls\ImageList\ImageList.cs (6)
528
HDC
dc = (
HDC
)g.GetHdc();
534
new HandleRef<
HDC
>(g, dc),
664
HDC
dc = (
HDC
)graphics.GetHdc();
670
new HandleRef<
HDC
>(graphics, dc),
System\Windows\Forms\Controls\Labels\Label.cs (1)
1349
private protected override void PrintToMetaFileRecursive(
HDC
hDC, IntPtr lParam, Rectangle bounds)
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (1)
2324
using Graphics g = Graphics.FromHdc((
HDC
)m.WParamInternal);
System\Windows\Forms\Controls\ListView\ListView.cs (1)
6959
using Graphics g = Graphics.FromHdc((
HDC
)m.WParamInternal);
System\Windows\Forms\Controls\TextBox\MaskedTextBox.cs (1)
2889
using Graphics g = Graphics.FromHdc((
HDC
)m.WParamInternal);
System\Windows\Forms\Controls\TextBox\TextBox.cs (2)
819
using Graphics g = Graphics.FromHdc((
HDC
)m.WParamInternal);
860
private void DrawPlaceholderText(
HDC
hdc)
System\Windows\Forms\Controls\TextBox\TextBoxBase.cs (1)
1994
internal override HBRUSH InitializeDCForWmCtlColor(
HDC
dc, MessageId msg)
System\Windows\Forms\Controls\ToolStrips\CachedItemHdcInfo.cs (5)
8
internal class CachedItemHdcInfo : IDisposable, IHandle<
HDC
>
14
private
HDC
_cachedItemHDC;
18
public
HDC
Handle => _cachedItemHDC;
22
public
HDC
GetCachedItemDC(
HDC
toolStripHDC, Size bitmapSize)
System\Windows\Forms\Controls\ToolStrips\ToolStrip.cs (2)
2649
private protected override void PrintToMetaFileRecursive(
HDC
hDC, IntPtr lParam, Rectangle bounds)
3492
HDC
itemHDC = ItemHdcInfo.GetCachedItemDC(toolStripHDC, bitmapSize);
System\Windows\Forms\Controls\TreeView\TreeView.cs (1)
3137
using Graphics g = Graphics.FromHdc((
HDC
)m.WParamInternal);
System\Windows\Forms\Design\ComponentEditorForm.PageSelector.cs (2)
89
HDC
dc,
260
private void FillRectDither(
HDC
dc, RECT rc)
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.cs (1)
161
private unsafe void MirrorDcIfNeeded(
HDC
hdc)
System\Windows\Forms\Input\Cursor.cs (1)
336
(
HDC
)dc,
System\Windows\Forms\Panels\Panel.cs (1)
224
private protected override void PrintToMetaFileRecursive(
HDC
hDC, IntPtr lParam, Rectangle bounds)
System\Windows\Forms\Rendering\ControlPaint.cs (1)
2054
HDC
dc,
System\Windows\Forms\Rendering\DCMapping.cs (2)
26
private readonly
HDC
_hdc;
29
public unsafe DCMapping(
HDC
hdc, Rectangle bounds)
System\Windows\Forms\Rendering\DrawingEventArgs.cs (4)
27
private readonly
HDC
_hdc;
47
HDC
dc,
77
internal
HDC
HDC => IsStateClean ? default : _hdc;
120
internal
HDC
GetHDC() => _hdc;
System\Windows\Forms\Rendering\DrawingEventFlags.cs (1)
24
/// default when constructing via an <see cref="
HDC
"/> as it, by definition, has no <see cref="Graphics"/>
System\Windows\Forms\Rendering\DrawItemEventArgs.cs (6)
57
HDC
hdc,
66
HDC
hdc,
159
internal
HDC
HDC => _event.HDC;
162
HDC
IHdcContext.GetHdc() => (
HDC
)((IDeviceContext)this).GetHdc();
166
HDC
IGraphicsHdcProvider.GetHdc() => _event.GetHDC();
System\Windows\Forms\Rendering\FontCache.Data.cs (1)
39
HDC
hdc = screenDC.HDC;
System\Windows\Forms\Rendering\GdiCache.cs (3)
19
/// Gets an <see cref="
HDC
"/> based off of the primary display.
26
/// When disposed the <see cref="
HDC
"/> will be returned to the cache. Do NOT change the state of the
43
/// When disposed the <see cref="Graphics"/> object will be disposed and the underlying <see cref="
HDC
"/>
System\Windows\Forms\Rendering\PaintEventArgs.cs (6)
49
HDC
hdc = e.HDC;
68
HDC
hdc,
132
internal
HDC
HDC => _event.HDC;
135
HDC
IHdcContext.GetHdc() => (
HDC
)((IDeviceContext)this).GetHdc();
139
HDC
IGraphicsHdcProvider.GetHdc() => _event.GetHDC();
System\Windows\Forms\Rendering\ScreenDcCache.cs (5)
51
return new ScreenDcScope(this, (
HDC
)item);
62
private void Release(
HDC
hdc)
80
PInvokeCore.DeleteDC((
HDC
)temp);
92
PInvokeCore.DeleteDC((
HDC
)hdc);
98
private static unsafe void ValidateHdc(
HDC
hdc)
System\Windows\Forms\Rendering\ScreenDcCache.ScreenDcScope.cs (3)
17
public
HDC
HDC { get; }
20
public ScreenDcScope(ScreenDcCache cache,
HDC
hdc)
26
public static implicit operator
HDC
(in ScreenDcScope scope) => scope.HDC;
System\Windows\Forms\Rendering\TextExtensions.cs (4)
50
this
HDC
hdc,
152
this
HDC
hdc,
211
this
HDC
hdc,
282
public static unsafe Size GetTextExtent(this
HDC
hdc, string? text, HFONT hfont)
System\Windows\Forms\Rendering\TextRenderer.cs (5)
330
HDC
hdc = e.HDC;
346
HDC
hdc,
356
HDC
hdc,
656
/// The <see cref="
HDC
"/> to get the font from if <paramref name="font"/> is <see langword="null"/>.
658
private static FontCache.Scope GetFontOrHdcHFONT(Font? font, FONT_QUALITY quality,
HDC
hdc)
System\Windows\Forms\Screen.cs (3)
54
internal unsafe Screen(HMONITOR monitor,
HDC
hdc)
56
HDC
screenDC = hdc;
109
PInvokeCore.EnumDisplayMonitors((HMONITOR hmonitor,
HDC
hdc) =>
System\Windows\Forms\Scrolling\ScrollBar.cs (1)
492
internal override HBRUSH InitializeDCForWmCtlColor(
HDC
dc, MessageId msg) => default;
System\Windows\Forms\VisualStyles\VisualStyleRenderer.cs (6)
219
internal unsafe void DrawBackground(
HDC
dc, Rectangle bounds, HWND hwnd = default)
248
internal unsafe void DrawBackground(
HDC
dc, Rectangle bounds, Rectangle clipRectangle, HWND hwnd)
275
internal unsafe Rectangle DrawEdge(
HDC
dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects)
379
internal void DrawText(
HDC
dc, Rectangle bounds, string? textToDraw, bool drawDisabled, TextFormatFlags flags)
413
internal Rectangle GetBackgroundContentRectangle(
HDC
dc, Rectangle bounds)
579
internal unsafe Size GetPartSize(
HDC
dc, ThemeSizeType type, HWND hwnd = default)
System.Windows.Forms.Design (1)
System\Windows\Forms\Design\ControlDesigner.cs (1)
2041
using Graphics g = Graphics.FromHdc((
HDC
)m.WParamInternal);
System.Windows.Forms.Primitives (29)
System\Windows\Forms\DeviceContextExtensions.cs (10)
26
this
HDC
hdc,
43
internal static void FillRectangle(this
HDC
hdc, Rectangle rectangle, HBRUSH hbrush)
56
internal static void DrawLine(this
HDC
hdc, HPEN hpen, Point p1, Point p2) =>
62
internal static void DrawLine(this
HDC
hdc, HPEN hpen, int x1, int y1, int x2, int y2) =>
80
internal static unsafe void DrawLines(this
HDC
hdc, HPEN hpen, ReadOnlySpan<int> lines)
101
/// Calls <see cref="PInvoke.GetNearestColor(
HDC
, COLORREF)"/> to get the nearest color for the given
117
internal static Color FindNearestColor(this
HDC
hdc, Color color)
123
internal static Graphics CreateGraphics(this
HDC
hdc) => Graphics.FromHdcInternal(hdc);
135
this
HDC
hdc,
152
internal static void FillRectangle(this
HDC
hdc, HBRUSH hbrush, Rectangle rectangle)
System\Windows\Forms\DeviceContextExtensions.IDeviceContextAdapter.cs (2)
14
public
HDC
GetHdc() => (
HDC
)_deviceContext.GetHdc();
Windows\Win32\PInvoke.DrawTextEx.cs (2)
8
/// <inheritdoc cref="DrawTextEx(
HDC
, PWSTR, int, RECT*, DRAW_TEXT_FORMAT, DRAWTEXTPARAMS*)"/>
10
HDC
hdc,
Windows\Win32\PInvoke.FillRect.cs (2)
8
/// <inheritdoc cref="FillRect(
HDC
, in RECT, HBRUSH)"/>
10
where T : IHandle<
HDC
>
Windows\Win32\PInvoke.GetTextExtentPoint32.cs (2)
10
/// <inheritdoc cref="GetTextExtentPoint32W(
HDC
, PCWSTR, int, SIZE*)"/>
11
public static unsafe BOOL GetTextExtentPoint32W<T>(T hdc, string lpString, int c, Size size) where T : IHandle<
HDC
>
Windows\Win32\PInvoke.GetThemeFont.cs (2)
10
/// <inheritdoc cref="GetThemeFont(HTHEME,
HDC
, int, int, int, LOGFONTW*)"/>
11
public static unsafe HRESULT GetThemeFont<T>(T hTheme,
HDC
hdc, int iPartId, int iStateId, int iPropId, out LOGFONT pFont)
Windows\Win32\PInvoke.ImageList.cs (4)
28
/// <inheritdoc cref="ImageList_Draw(HIMAGELIST, int,
HDC
, int, int, IMAGE_LIST_DRAW_STYLE)"/>
29
public static bool Draw<T>(T himl, int i,
HDC
hdcDst, int x, int y, IMAGE_LIST_DRAW_STYLE fStyle)
37
/// <inheritdoc cref="ImageList_DrawEx(HIMAGELIST, int,
HDC
, int, int, int, int, COLORREF, COLORREF, IMAGE_LIST_DRAW_STYLE)"/>
48
IMAGE_LIST_DRAW_STYLE fStyle) where THIML : IHandle<HIMAGELIST> where THDC : IHandle<
HDC
>
Windows\Win32\PInvoke.IntersectClipRect.cs (2)
8
/// <inheritdoc cref="IntersectClipRect(
HDC
, int, int, int, int)"/>
9
public static GDI_REGION_TYPE IntersectClipRect<T>(T hdc, int left, int top, int right, int bottom) where T : IHandle<
HDC
>
Windows\Win32\UI\Controls\Dialogs\CHOOSEFONTW.cs (1)
56
public
HDC
hDC;
Windows\Win32\UI\Controls\Dialogs\PRINTDLGW_32.cs (1)
24
public
HDC
hDC;
Windows\Win32\UI\Controls\Dialogs\PRINTDLGW_64.cs (1)
120
public
HDC
hDC;
System.Windows.Forms.Primitives.Tests (9)
System\Windows\Forms\DeviceContextHdcScopeTests.cs (1)
251
HDC
mockHdc = new(1234);
System\Windows\Forms\DeviceContextScopeTests.cs (2)
13
private static extern int GetRandomRgn(
HDC
hdc, HRGN hrgn, int i);
80
Assert.Equal(dcScope.HDC, (
HDC
)hdc);
System\Windows\Forms\Internals\ArgumentValidationTests.cs (3)
91
HDC
param = new(IntPtr.Zero);
99
HDC
param = new(new IntPtr(24));
106
HDC
param = new(IntPtr.Zero);
Windows\Win32\RegionTests.cs (3)
14
using CreateDcScope hdc = new(
HDC
.Null);
34
using CreateDcScope hdc = new(
HDC
.Null);
48
using CreateDcScope hdc = new(
HDC
.Null);
System.Windows.Forms.Primitives.TestUtilities (14)
DeviceContextState.cs (1)
26
public DeviceContextState(
HDC
hdc)
HdcDeviceContextAdapter.cs (3)
9
/// Simple adapter for passing <see cref="
HDC
"/> as <see cref="IDeviceContext"/>. Does not manage HDC
14
private readonly
HDC
_hdc;
16
public HdcDeviceContextAdapter(
HDC
hdc) => _hdc = hdc;
Metafiles\EmfRecord.cs (2)
11
public
HDC
HDC { get; }
18
HDC
hdc,
Metafiles\EmfScope.cs (8)
19
public
HDC
HDC { get; }
27
public EmfScope(
HDC
hdc)
38
private static unsafe
HDC
CreateEnhMetaFile(
39
HDC
hdc = default,
47
HDC
metafileHdc = PInvokeCore.CreateEnhMetaFile(hdc, pFileName, lprc, pDesc);
86
(delegate* unmanaged[Stdcall]<
HDC
, HANDLETABLE*, ENHMETARECORD*, int, LPARAM, int>)callback,
234
HDC
hdc,
247
public static implicit operator
HDC
(in EmfScope scope) => scope.HDC;
System.Windows.Forms.Tests (7)
System\Windows\Forms\AxHostTests.cs (3)
1594
iPicture.get_CurDC(out
HDC
hdc).Should().Be(HRESULT.E_FAIL);
1680
iPicture.get_CurDC(out
HDC
curDc).ThrowOnFailure();
1708
iPicture.get_CurDC(out
HDC
_).Should().Be(HRESULT.E_FAIL);
System\Windows\Forms\ComponentModel\Com2Interop\COM2PictureConverterTests.cs (4)
197
public HRESULT get_CurDC(
HDC
* phDC) => HRESULT.S_OK;
202
public HRESULT Render(
HDC
hDC, int x, int y, int cx, int cy, int xSrc, int ySrc, int cxSrc, int cySrc, RECT* pRcWBounds) => HRESULT.S_OK;
204
public HRESULT SelectPicture(
HDC
hDCIn,
HDC
* phDCOut, OLE_HANDLE* phBmpOut) => HRESULT.S_OK;