private static extern IntPtr GetDCEx_IntPtr(IntPtr hWnd, IntPtr hrgnClip, DeviceContextValues flags);
public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, DeviceContextValues flags);
/// <summary> /// The GetDCEx function retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen. /// You can use the returned handle in subsequent GDI functions to draw in the DC. The device context is an opaque data structure, whose values are used internally by GDI. /// This function is an extension to the <see cref="GetDC"/> function, which gives an application more control over how and whether clipping occurs in the client area. /// </summary> /// <param name="hWnd">A handle to the window whose DC is to be retrieved. If this value is <see cref="IntPtr.Zero"/>, GetDCEx retrieves the DC for the entire screen.</param> /// <param name="hrgnClip"> /// A clipping region that may be combined with the visible region of the DC. /// If the value of flags is <see cref="DeviceContextValues.DCX_INTERSECTRGN"/> or <see cref="DeviceContextValues.DCX_EXCLUDERGN"/>, /// then the operating system assumes ownership of the region and will automatically delete it when it is no longer needed. /// In this case, the application should not use or delete the region after a successful call to GetDCEx.</param> /// <param name="flags">Specifies how the DC is created.</param> /// <returns> /// If the function succeeds, the return value is the handle to the DC for the specified window. If the function fails, the return value is <see cref="SafeDCHandle.Null"/>. /// An invalid value for the hWnd parameter will cause the function to fail. /// </returns> /// <remarks> /// <para> /// Unless the display DC belongs to a window class, the <see cref="ReleaseDC"/> function must be called to release the DC after painting. /// Also, <see cref="ReleaseDC"/> must be called from the same thread that called GetDCEx. The number of DCs is limited only by available memory. /// </para> /// <para> /// The function returns a handle to a DC that belongs to the window's class if CS_CLASSDC, CS_OWNDC or CS_PARENTDC was specified as a style in the WNDCLASS structure when the class was registered. /// </para> /// </remarks> public static SafeDCHandle GetDCEx(IntPtr hWnd, IntPtr hrgnClip, DeviceContextValues flags) { var hdc = GetDCEx_IntPtr(hWnd, hrgnClip, flags); return(hdc != IntPtr.Zero ? new SafeDCHandle(hWnd, hdc) : null); }
public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, DeviceContextValues flags);
public static IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, DeviceContextValues flags) { NotImplemented(MethodBase.GetCurrentMethod()); return(IntPtr.Zero); }
public static extern IntPtr GetDCEx(HandleRef hWnd, HandleRef hrgnClip, DeviceContextValues flags);
/// <summary> /// The GetDCEx function retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen. /// You can use the returned handle in subsequent GDI functions to draw in the DC. The device context is an opaque data structure, whose values are used internally by GDI. /// This function is an extension to the <see cref="GetDC"/> function, which gives an application more control over how and whether clipping occurs in the client area. /// </summary> /// <param name="hWnd">A handle to the window whose DC is to be retrieved. If this value is <see cref="IntPtr.Zero"/>, GetDCEx retrieves the DC for the entire screen.</param> /// <param name="hrgnClip"> /// A clipping region that may be combined with the visible region of the DC. /// If the value of flags is <see cref="DeviceContextValues.DCX_INTERSECTRGN"/> or <see cref="DeviceContextValues.DCX_EXCLUDERGN"/>, /// then the operating system assumes ownership of the region and will automatically delete it when it is no longer needed. /// In this case, the application should not use or delete the region after a successful call to GetDCEx.</param> /// <param name="flags">Specifies how the DC is created.</param> /// <returns> /// If the function succeeds, the return value is the handle to the DC for the specified window. If the function fails, the return value is <see cref="SafeDCHandle.Null"/>. /// An invalid value for the hWnd parameter will cause the function to fail. /// </returns> /// <remarks> /// <para> /// Unless the display DC belongs to a window class, the <see cref="ReleaseDC"/> function must be called to release the DC after painting. /// Also, <see cref="ReleaseDC"/> must be called from the same thread that called GetDCEx. The number of DCs is limited only by available memory. /// </para> /// <para> /// The function returns a handle to a DC that belongs to the window's class if CS_CLASSDC, CS_OWNDC or CS_PARENTDC was specified as a style in the WNDCLASS structure when the class was registered. /// </para> /// </remarks> public static SafeDCHandle GetDCEx(IntPtr hWnd, IntPtr hrgnClip, DeviceContextValues flags) { var hdc = GetDCEx_IntPtr(hWnd, hrgnClip, flags); return hdc != IntPtr.Zero ? new SafeDCHandle(hWnd, hdc) : null; }