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

CreateBitmapScope

Helper to scope lifetime of a HBITMAP created via CreateBitmap Deletes the HBITMAP (if any) when disposed.
public HBITMAP HBITMAP { get; }

public bool IsNull { get; }

public CreateBitmapScope(int nWidth, int nHeight, uint nPlanes, uint nBitCount, Void* lpvBits)

Creates a bitmap using CreateBitmap

public CreateBitmapScope(HDC hdc, int cx, int cy)

Creates a bitmap compatible with the given HDC via CreateCompatibleBitmap

public static IntPtr op_Explicit(ref CreateBitmapScope scope)

public static HBITMAP op_Implicit(ref CreateBitmapScope scope)

public static HGDIOBJ op_Implicit(ref CreateBitmapScope scope)

public void Dispose()