<PackageReference Include="System.Drawing.Common" Version="9.0.10" />

GetDcScope

struct GetDcScope
Helper to scope lifetime of an HDC retrieved via GetDC and GetDCEx. Releases the HDC (if any) when disposed.
public static GetDcScope ScreenDC { get; }

Creates a DC scope for the primary monitor (not the entire desktop).

public HDC HDC { get; }

public HWND HWND { get; }

public bool IsNull { get; }

public GetDcScope(HWND hwnd)

public GetDcScope(HWND hwnd, HRGN hrgnClip, GET_DCX_FLAGS flags)

Creates a HDC using GetDCEx.

public static IntPtr op_Implicit(ref GetDcScope scope)

public static HDC op_Implicit(ref GetDcScope scope)

public void Dispose()