CDC::DrawIcon

Draws an icon on the device represented by the current CDC object.

BOOL DrawIcon(
   int x,
   int y,
   HICON hIcon 
);
BOOL DrawIcon(
   POINT point,
   HICON hIcon 
);

Parameters

  • x
    Specifies the logical x-coordinate of the upper-left corner of the icon.

  • y
    Specifies the logical y-coordinate of the upper-left corner of the icon.

  • hIcon
    Identifies the handle of the icon to be drawn.

  • point
    Specifies the logical x- and y-coordinates of the upper-left corner of the icon. You can pass a POINT structure or a CPoint object for this parameter.

Return Value

Nonzero if the function completed successfully; otherwise 0.

Remarks

The function places the icon's upper-left corner at the location specified by x and y. The location is subject to the current mapping mode of the device context.

The icon resource must have been previously loaded by using the functions CWinApp::LoadIcon, CWinApp::LoadStandardIcon, or CWinApp::LoadOEMIcon. The MM_TEXT mapping mode must be selected prior to using this function.

Example

See the example for CWnd::IsIconic.

Requirements

Header: afxwin.h

See Also

Concepts

CDC Class

CDC Members

Hierarchy Chart

CWinApp::LoadIcon

CWinApp::LoadStandardIcon

CWinApp::LoadOEMIcon

CDC::GetMapMode

CDC::SetMapMode

DrawIcon

POINT Structure