CDC::SetPixel

Syntax

DWORD SetPixel( int x, int y, DWORD crColor );

DWORD SetPixel( POINT point, DWORD crColor );

Parameters

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.

point

Specifies the logical x- and y-coordinates of the point to be set. You can pass either a POINT structure or a CPoint object for this parameter.

Remarks

Sets the pixel at the point specified to the closest approximation of the color specified by crColor. The point must be in the clipping region. If the point is not in the clipping region, the function is ignored.

Not all devices support the function. For more information, see the RC_BITBLT capability in the GetDeviceCaps member function.

Return Value

An RGB color value for the color that the point is actually painted. This value can be different than that specified by crColor if an approximation of that color is used. If the function fails (if the point is outside the clipping region), the return value is -1.

See Also

CDC::GetDeviceCaps, CDC::GetPixel, ::SetPixel