共用方式為


CMFCCaptionBar::SetBitmap

Sets the bitmap image for the caption bar.

void SetBitmap(
   HBITMAP hBitmap,
   COLORREF clrTransparent,
   BOOL bStretch=FALSE,
   BarElementAlignment bmpAlignment=ALIGN_RIGHT 
);
void SetBitmap(
   UINT uiBmpResID,
   COLORREF clrTransparent,
   BOOL bStretch=FALSE,
   BarElementAlignment bmpAlignment=ALIGN_RIGHT 
);

Parameters

  • [in] hBitmap
    The handle to the bitmap to set.

  • [in] clrTransparent
    An RGB value that specifies the transparent color of the bitmap.

  • [in] bStretch
    If TRUE, the bitmap is stretched if it does not fit to the image bounding rectangle. Otherwise the bitmap is not stretched.

  • [in] bmpAlignment
    The alignment of the bitmap.

Remarks

Use this method to set a bitmap on a caption bar.

The previous bitmap is destroyed automatically. If the caption bar displays an icon because you called the CMFCCaptionBar::SetIcon method, the bitmap will not be displayed unless you remove the icon by calling CMFCCaptionBar::RemoveIcon.

The bitmap is aligned as specified by the bmpAlignment parameter. This parameter can be one of the following BarElementAlignment values:

  • ALIGN_INVALID

  • ALIGN_LEFT

  • ALIGN_RIGHT

  • ALIGN_CENTER

Requirements

Header: afxcaptionbar.h

See Also

Reference

CMFCCaptionBar Class

Hierarchy Chart