Method SetPixelFormat
SetPixelFormat(nint, int, ref PIXELFORMATDESCRIPTOR)
Sets the pixel format for a device context to the specified format.
public static extern bool SetPixelFormat(nint hdc, int format, ref MswUtils.NativeMethods.PIXELFORMATDESCRIPTOR pfd)
Parameters
hdcnintA handle to the device context for which the pixel format is to be set.
formatintThe index of the pixel format to set. This value must correspond to a valid pixel format supported by the device context.
pfdMswUtils.NativeMethods.PIXELFORMATDESCRIPTORA reference to a MswUtils.NativeMethods.PIXELFORMATDESCRIPTOR structure that defines the properties of the pixel format.
Returns
Remarks
This method is a P/Invoke wrapper for the GDI SetPixelFormat function. The
pixel format must be set before rendering to the device context. Once a pixel format is set,
it cannot be changed for the lifetime of the device context.