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

Windows.Win32.Graphics.Gdi.CreateDcScope

struct CreateDcScope
Helper to scope lifetime of an HDC retrieved via CreateDC/CreateCompatibleDC. Deletes the HDC (if any) when disposed.
namespace Windows.Win32.Graphics.Gdi { internal readonly ref struct CreateDcScope { public HDC HDC { get; } public bool IsNull { get; } public CreateDcScope(HDC hdc); public unsafe CreateDcScope(string driverName, string deviceName = null, DEVMODEW* lpInitData = default(DEVMODEW*), bool informationOnly = true); public static implicit operator HDC(ref CreateDcScope scope); public static implicit operator HGDIOBJ(ref CreateDcScope scope); public static implicit operator IntPtr(ref CreateDcScope scope); public static explicit operator WPARAM(ref CreateDcScope scope); public void Dispose(); } }