DrawIcon function

Draws an icon or cursor into the specified device context.

To specify additional drawing options, use the DrawIconEx function.

Syntax

BOOL DrawIcon(
  HDC   hDC,
  int   X,
  int   Y,
  HICON hIcon
);

Parameters

hDC

Type: HDC

A handle to the device context into which the icon or cursor will be drawn.

X

Type: int

The logical x-coordinate of the upper-left corner of the icon.

Y

Type: int

The logical y-coordinate of the upper-left corner of the icon.

hIcon

Type: HICON

A handle to the icon to be drawn.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

DrawIcon places the icon's upper-left corner at the location specified by the X and Y parameters. The location is subject to the current mapping mode of the device context.

DrawIcon draws the icon or cursor using the width and height specified by the system metric values for icons; for more information, see GetSystemMetrics.

Examples

For an example, see Displaying an Icon.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Conceptual

CreateIcon

DrawIconEx

Icons

LoadIcon

Reference