DrawIcon function

Draws an icon or cursor into the specified device context.

To specify additional drawing options, use the DrawIconEx function.

Syntax


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

Parameters

hDC [in]

Type: HDC

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

X [in]

Type: int

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

Y [in]

Type: int

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

hIcon [in]

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]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
CreateIcon
DrawIconEx
LoadIcon
Conceptual
Icons

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.