2.2.6.22.10 PictureControl::SetIcon

Description

Sets a picture from a HICON to be displayed in the control

Syntax

BOOL SetIcon( HICON hIcon, BOOL bTakeOwnership = TRUE )

Parameters

hIcon
Handle to an Icon
bTakeOwnership
TRUE means that the control will destroy the object on destroy or on setting another picture

Return

return true when successful else false

Examples

EX1

#include <Control.h>
#include <OC_Res.h>
void PictureControl_SetIcon()
{
	PictureControl pc;
	HINSTANCE hinstOrg =  GetModuleHandle();
	if(!hinstOrg)
		return ;

	HICON hIcon = NULL;
	{
		char *lpcszID = (char*)IDI_FOLDER_CLOSED;
		hIcon = LoadImage(hinstOrg, lpcszID, IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
	}
	pc.SetIcon(hIcon);
}

Remark

See Also

Header to Include

Control.h