Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Draws an icon or cursor into the specified device context.
To specify additional drawing options, use the DrawIconEx function.
Syntax
BOOL DrawIcon(
[in] HDC hDC,
[in] int X,
[in] int Y,
[in] HICON hIcon
);
Parameters
[in] hDC
Type: HDC
A handle to the device context into which the icon or cursor will be drawn.
[in] X
Type: int
The logical x-coordinate of the upper-left corner of the icon.
[in] Y
Type: int
The logical y-coordinate of the upper-left corner of the icon.
[in] 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.
The DrawIcon function calls DrawIconEx passing DI_NORMAL|DI_DEFAULTSIZE
as flags.
Examples
For an example, see Displaying an Icon.
Requirements
Requirement | Value |
---|---|
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 |
API set | ext-ms-win-ntuser-gui-l1-3-1 (introduced in Windows 10, version 10.0.14393) |
See also
Conceptual
Reference