共用方式為


CPictureHolder::CreateFromBitmap

Uses a bitmap to initialize the picture object in a CPictureHolder.

BOOL CreateFromBitmap( 
   UINT idResource  
); 
BOOL CreateFromBitmap( 
   CBitmap* pBitmap, 
   CPalette* pPal = NULL, 
   BOOL bTransferOwnership = TRUE  
); 
BOOL CreateFromBitmap( 
   HBITMAP hbm, 
   HPALETTE hpal = NULL, 
   BOOL bTransferOwnership = FALSE  
);

Parameters

  • idResource
    Resource ID of a bitmap resource.

  • pBitmap
    Pointer to a CBitmap object.

  • pPal
    Pointer to a CPalette object.

  • bTransferOwnership
    Indicates whether the picture object will take ownership of the bitmap and palette objects.

  • hbm
    Handle to the bitmap from which the CPictureHolder object is created.

  • hpal
    Handle to the palette used for rendering the bitmap.

Return Value

Nonzero if the object is successfully created; otherwise 0.

Remarks

If bTransferOwnership is TRUE, the caller should not use the bitmap or palette object in any way after this call returns. If bTransferOwnership is FALSE, the caller is responsible for ensuring that the bitmap and palette objects remain valid for the lifetime of the picture object.

Requirements

Header: afxwin.h

See Also

Reference

CPictureHolder Class

Hierarchy Chart

CPictureHolder::CreateEmpty

CPictureHolder::CreateFromIcon

CPictureHolder::CreateFromMetafile