GetNearestColor function

The GetNearestColor function retrieves a color value identifying a color from the system palette that will be displayed when the specified color value is used.

Syntax


COLORREF GetNearestColor(
  _In_ HDC      hdc,
  _In_ COLORREF crColor
);

Parameters

hdc [in]

A handle to the device context.

crColor [in]

A color value that identifies a requested color. To create a COLORREF color value, use the RGB macro.

Return value

If the function succeeds, the return value identifies a color from the system palette that corresponds to the given color value.

If the function fails, the return value is CLR_INVALID.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

See also

Colors Overview
Color Functions
GetDeviceCaps
GetNearestPaletteIndex
COLORREF
RGB

 

 

Show: