共用方式為


CPictureHolder::CreateFromIcon

Uses an icon to initialize the picture object in a CPictureHolder.

BOOL CreateFromIcon( 
   UINT idResource  
); 
BOOL CreateFromIcon( 
   HICON hIcon, 
   BOOL bTransferOwnership = FALSE  
);

Parameters

  • idResource
    Resource ID of a bitmap resource.

  • hIcon
    Handle to the icon from which the CPictureHolder object is created.

  • bTransferOwnership
    Indicates whether the picture object will take ownership of the icon object.

Return Value

Nonzero if the object is successfully created; otherwise 0.

Remarks

If bTransferOwnership is TRUE, the caller should not use the icon object in any way after this call returns. If bTransferOwnership is FALSE, the caller is responsible for ensuring that the icon object remains valid for the lifetime of the picture object.

Requirements

Header: afxwin.h

See Also

Reference

CPictureHolder Class

Hierarchy Chart

CPictureHolder::CreateEmpty

CPictureHolder::CreateFromBitmap

CPictureHolder::CreateFromMetafile