CBitmapButton::LoadBitmaps

请使用此功能,当要加载的资源名称或ID号以确定的位图图像,或者,当无法使用 AutoLoad 函数时,这是因为,例如,创建不是对话框的一部分位图按钮。

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  
);

参数

  • lpszBitmapResource
    指向包含位图的名称以位图的按钮或“状态的Null终止的字符串。 必需。

  • lpszBitmapResourceSel
    指向包含位图的名称选定的位图按钮的Null终止的字符串或“向下”状态。 可能为 NULL

  • lpszBitmapResourceFocus
    指向包含位图的名称位图按钮的中心状态的Null终止的字符串。 可能为 NULL

  • lpszBitmapResourceDisabled
    指向包含位图的名称位图按钮的禁用状态的Null终止的字符串。 可能为 NULL

  • nIDBitmapResource
    指定位图资源的资源ID号用于常规位图的按钮或“状态。 必需。

  • nIDBitmapResourceSel
    为选定的位图按钮的指定位图资源的资源ID号或“向下”状态。 可能为0。

  • nIDBitmapResourceFocus
    为位图按钮的中心的状态指定位图资源的资源ID号。 可能为0。

  • nIDBitmapResourceDisabled
    为位图按钮的禁用状态指定位图资源的资源ID号。 可能为0。

返回值

非零,如果成功;否则为0。

示例

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); 

要求

Header: afxext.h

请参见

参考

CBitmapButton Class

层次结构图

CBitmapButton::AutoLoad

CBitmapButton::SizeToContent

CButton::Create

CBitmap::LoadBitmap