Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function sets the pixel at the specified coordinates to the specified color.
Syntax
COLORREF SetPixel( HDC hdc, int X, int Y, COLORREF crColor ); |
Parameters
- hdc
-
[in] Handle to the device context.
- X
-
[in] Specifies the x-coordinate, in logical units, of the point to be set.
- Y
-
[in] Specifies the y-coordinate, in logical units, of the point to be set.
- crColor
-
[in] Specifies the color to be used to paint the point.
Return Value
The RGB value that the function sets the pixel to indicates success.
This value may differ from the color specified by crColor; that happens when an exact match for the specified color cannot be found.
–1 indicates failure.
To get extended error information, call GetLastError.
Remarks
The function fails if the pixel coordinates lie outside of the current clipping region.
Not all devices support the SetPixelfunction. For more information, see GetDeviceCaps.
Requirements
Header | windows.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 2.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |