<PackageReference Include="System.Drawing.Common" Version="10.0.0-preview.5.25277.114" />

HBITMAP

using System; using System.CodeDom.Compiler; using System.Diagnostics; using System.Runtime.CompilerServices; namespace Windows.Win32.Graphics.Gdi { [DebuggerDisplay("{Value}")] [GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")] internal readonly struct HBITMAP : IDisposable, IEquatable<HBITMAP> { internal unsafe readonly void* Value; internal static readonly HBITMAP HBMMENU_CALLBACK = (HBITMAP)(IntPtr)(-1); internal static readonly HBITMAP HBMMENU_SYSTEM = (HBITMAP)(IntPtr)1; internal static readonly HBITMAP HBMMENU_MBAR_RESTORE = (HBITMAP)(IntPtr)2; internal static readonly HBITMAP HBMMENU_MBAR_MINIMIZE = (HBITMAP)(IntPtr)3; internal static readonly HBITMAP HBMMENU_MBAR_CLOSE = (HBITMAP)(IntPtr)5; internal static readonly HBITMAP HBMMENU_MBAR_CLOSE_D = (HBITMAP)(IntPtr)6; internal static readonly HBITMAP HBMMENU_MBAR_MINIMIZE_D = (HBITMAP)(IntPtr)7; internal static readonly HBITMAP HBMMENU_POPUP_CLOSE = (HBITMAP)(IntPtr)8; internal static readonly HBITMAP HBMMENU_POPUP_RESTORE = (HBITMAP)(IntPtr)9; internal static readonly HBITMAP HBMMENU_POPUP_MAXIMIZE = (HBITMAP)(IntPtr)10; internal static readonly HBITMAP HBMMENU_POPUP_MINIMIZE = (HBITMAP)(IntPtr)11; internal static HBITMAP Null => default(HBITMAP); internal unsafe bool IsNull => Value == null; public void Dispose() { if (!IsNull) PInvokeCore.DeleteObject(this); } public HBITMAP CreateCompatibleBitmap(int width, int height) { GetDcScope scope = GetDcScope.ScreenDC; try { CreateDcScope scope2 = new CreateDcScope((HDC)ref scope); try { SelectObjectScope selectObjectScope = new SelectObjectScope((HDC)ref scope2, this); try { CreateDcScope scope3 = new CreateDcScope((HDC)ref scope); try { HBITMAP hBITMAP = PInvokeCore.CreateCompatibleBitmap((HDC)ref scope, width, height); SelectObjectScope selectObjectScope2 = new SelectObjectScope((HDC)ref scope3, hBITMAP); try { PInvokeCore.BitBlt((HDC)ref scope3, 0, 0, width, height, (HDC)ref scope2, 0, 0, ROP_CODE.SRCCOPY); return hBITMAP; } finally { selectObjectScope2.Dispose(); } } finally { scope3.Dispose(); } } finally { selectObjectScope.Dispose(); } } finally { scope2.Dispose(); } } finally { scope.Dispose(); } } internal unsafe HBITMAP(void* value) { Value = value; } internal unsafe HBITMAP(IntPtr value) { this = new HBITMAP((void*)(long)value); } public unsafe static implicit operator void*(HBITMAP value) { return value.Value; } public unsafe static explicit operator HBITMAP(void* value) { return new HBITMAP(value); } public unsafe static bool operator ==(HBITMAP left, HBITMAP right) { return left.Value == right.Value; } public static bool operator !=(HBITMAP left, HBITMAP right) { return !(left == right); } public unsafe bool Equals(HBITMAP other) { return Value == other.Value; } public override bool Equals(object obj) { if (obj is HBITMAP) { HBITMAP other = (HBITMAP)obj; return Equals(other); } return false; } public unsafe override int GetHashCode() { return (int)Value; } public unsafe override string ToString() { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(2, 1); defaultInterpolatedStringHandler.AppendLiteral("0x"); defaultInterpolatedStringHandler.AppendFormatted((UIntPtr)Value, "x"); return defaultInterpolatedStringHandler.ToStringAndClear(); } public unsafe static implicit operator IntPtr(HBITMAP value) { return new IntPtr(value.Value); } public unsafe static explicit operator HBITMAP(IntPtr value) { return new HBITMAP(value.ToPointer()); } public unsafe static explicit operator HBITMAP(UIntPtr value) { return new HBITMAP(value.ToPointer()); } public unsafe static implicit operator HGDIOBJ(HBITMAP value) { return new HGDIOBJ(value.Value); } } }