/// <summary> /// Selects the given object into the specified device context. /// </summary> /// <returns>The previous object or null if failed OR null if the given object was a region.</returns> public static GdiObjectHandle SelectObject(DeviceContext deviceContext, GdiObjectHandle @object) { IntPtr handle = Imports.SelectObject(deviceContext, @object); if (handle == IntPtr.Zero) { return(null); } ObjectType type = Imports.GetObjectType(@object.DangerousGetHandle()); if (type == ObjectType.Region) { return(null); } return(GdiObjectHandle.Create(handle, ownsHandle: false)); }
public static extern IntPtr SelectObject( DeviceContext hdc, GdiObjectHandle hgdiobj);
public unsafe static extern int GetObjectW( GdiObjectHandle hgdiobj, int cbBuffer, void *lpvObject);
public static GdiObjectHandle GetStockObject(StockObject @object) { IntPtr handle = Imports.GetStockObject((int)@object); return(GdiObjectHandle.Create(handle, ownsHandle: false)); }