CButton::SetBitmap

HBITMAP SetBitmap( HBITMAP hBitmap );

Return Value

The handle of a bitmap previously associated with the button.

Parameters

hBitmap

The handle of a bitmap.

Remarks

Call this member function to associate a new bitmap with the button.

The bitmap will be automatically placed on the face of the button, centered by default.  If the bitmap is too large for the button, it will be clipped on either side. You can choose other alignment options, including the following:

Unlike CBitmapButton, which uses four bitmaps per button, SetBitmap uses only one bitmap per the button. When the button is pressed, the bitmap appears to shift down and to the right.

Example

CButton myButton;

// Create a bitmap button.
myButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_BITMAP, 
   CRect(10,10,60,50), pParentWnd, 1);

// Set the bitmap of the button to be the system check mark bitmap.
myButton.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(OBM_CHECK)) );

CButton OverviewClass MembersHierarchy Chart

See Also   CButton::GetBitmap, CBitmapButton, CBitmapButton::LoadBitmaps, Bitmaps