Share via


CBitmapButton::LoadBitmaps

Use this function when you want to load bitmap images identified by their resource names or ID numbers, or when you cannot use the AutoLoad function because, for example, you are creating a bitmap button that is not part of a dialog box.

BOOL LoadBitmaps( 
   LPCTSTR lpszBitmapResource, 
   LPCTSTR lpszBitmapResourceSel = NULL, 
   LPCTSTR lpszBitmapResourceFocus = NULL, 
   LPCTSTR lpszBitmapResourceDisabled = NULL  
); 
BOOL LoadBitmaps( 
   UINT nIDBitmapResource, 
   UINT nIDBitmapResourceSel = 0, 
   UINT nIDBitmapResourceFocus = 0, 
   UINT nIDBitmapResourceDisabled = 0  
);

Parameters

  • lpszBitmapResource
    Points to the null-terminated string that contains the name of the bitmap for a bitmap button's normal or "up" state. Required.

  • lpszBitmapResourceSel
    Points to the null-terminated string that contains the name of the bitmap for a bitmap button's selected or "down" state. May be NULL.

  • lpszBitmapResourceFocus
    Points to the null-terminated string that contains the name of the bitmap for a bitmap button's focused state. May be NULL.

  • lpszBitmapResourceDisabled
    Points to the null-terminated string that contains the name of the bitmap for a bitmap button's disabled state. May be NULL.

  • nIDBitmapResource
    Specifies the resource ID number of the bitmap resource for a bitmap button's normal or "up" state. Required.

  • nIDBitmapResourceSel
    Specifies the resource ID number of the bitmap resource for a bitmap button's selected or "down" state. May be 0.

  • nIDBitmapResourceFocus
    Specifies the resource ID number of the bitmap resource for a bitmap button's focused state. May be 0.

  • nIDBitmapResourceDisabled
    Specifies the resource ID number of the bitmap resource for a bitmap button's disabled state. May be 0.

Return Value

Nonzero if successful; otherwise 0.

Example

CBitmapButton* pmyButton = new CBitmapButton();

// Create the bitmap button (must include the BS_OWNERDRAW style).
pmyButton->Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW, 
   CRect(10,10,100,100), pParentWnd, 1);

// Load the bitmaps for this button.
pmyButton->LoadBitmaps(IDB_UP, IDB_DOWN, IDB_FOCUS, IDB_DISABLE); 

Requirements

Header: afxext.h

See Also

Reference

CBitmapButton Class

Hierarchy Chart

CBitmapButton::AutoLoad

CBitmapButton::SizeToContent

CButton::Create

CBitmap::LoadBitmap