SetPixel

  COLORREF SetPixel(hdc, X, Y, crColor)    
  HDC hdc; /* handle of device context */
  int X; /* x-coordinate of pixel */
  int Y; /* y-coordinate of pixel */
  COLORREF crColor; /* pixel color */

The SetPixel function sets the pixel at the specified coordinates to the specified color.

Parameters

hdc

Identifies the device context.

X

Specifies the logical x-coordinate of the point to be set.

Y

Specifies the logical y-coordinate of the point to be set.

crColor

Specifies the color used to paint the point.

Return Value

The return value specifies the original color of the pixel if the function was successful. If the specified coordinates correspond to a pixel outside of the current clipping region, the return value is -1. If the function fails for any other reason, the return value is COLOR_INVALID.

Comments

The pixel at the specified coordinates must be within the boundaries of the current clipping region.

Not all devices support the SetPixel function. For more information, see the description of the GetDeviceCaps function.

See Also

GetDeviceCaps, SetPixelV