共用方式為


CMFCCaptionBar::SetIcon

Sets the icon for a caption bar.

void SetIcon(
   HICON hIcon,
   BarElementAlignment iconAlignment=ALIGN_RIGHT 
);

Parameters

  • [in] hIcon
    The handle to the icon to set.

  • [in] iconAlignment
    The alignment of the icon.

Remarks

Caption bars can display either icons or bitmaps. See CMFCCaptionBar::SetBitmap to find out how to display a bitmap. If you set both an icon and a bitmap, the icon is always displayed. Call CMFCCaptionBar::RemoveIcon to remove an icon from the caption bar.

The icon is aligned according to the iconAlignment parameter. It 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