Compartir a través de


CButton::SetBitmap

Llame a esta función miembro para asociar un nuevo mapa de bits con el botón.

HBITMAP SetBitmap(
   HBITMAP hBitmap 
);

Parámetros

  • hBitmap
    el identificador de un mapa de bits.

Valor devuelto

El identificador de un mapa de bits asociado previamente al botón.

Comentarios

El mapa de bits automáticamente se colocará en la apariencia del botón, centrado de forma predeterminada.Si el mapa de bits es demasiado grande para el botón, se recortarán por ambas partes.Puede elegir otras opciones de alineación, incluidas las siguientes:

  • BS_TOP

  • BS_LEFT

  • BS_RIGHT

  • BS_CENTER

  • BS_BOTTOM

  • BS_VCENTER

A diferencia de CBitmapButton, que utiliza cuatro mapas de bits por el botón, SetBitmap utiliza sólo un mapa de bits en el botón.Cuando se presiona el botón, el mapa de bits aparece para desplazarse hacia abajo y a la derecha.

Es responsable de liberar el mapa de bits cuando se hace con él.

Ejemplo

CButton myBitmapButton;

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

// If no bitmap is defined for the button, define the bitmap to the
// system close bitmap.
if (myBitmapButton.GetBitmap() == NULL)
   myBitmapButton.SetBitmap(::LoadBitmap(NULL, MAKEINTRESOURCE(OBM_CLOSE)));

Requisitos

encabezado: afxwin.h

Vea también

Referencia

Clase de CButton

Gráfico de jerarquía

CButton::GetBitmap

Clase de CBitmapButton

CBitmapButton::LoadBitmaps

Bitmaps