public static HDC CreateCompatibleDC(HDC hdc) { HDC value = null; if (hdc == null) { value = _CreateCompatibleDC(IntPtr.Zero); } else { value = _CreateCompatibleDC(hdc); } if (value != null && value.DangerousGetHandle() != IntPtr.Zero) { value.DangerousOwnsHandle = true; } return(value); }