Delen via


CMFCCaptionButton Class

The CMFCCaptionButton class implements a button that is displayed on the caption bar for a docking pane or a mini-frame window. Typically, the framework creates caption buttons automatically.

class CMFCCaptionButton : public CObject

Members

Constructors

Name

Description

CMFCCaptionButton::CMFCCaptionButton

Constructs a CMFCCaptionButton object.

Public Methods

Name

Description

CMFCCaptionButton::GetHit

Returns the command represented by the button.

CMFCCaptionButton::GetIconID

Returns the image ID associated with the button.

CMFCCaptionButton::GetRect

Returns the rectangle occupied by the button.

CMFCCaptionButton::GetSize

Returns the width and height of the button.

CMFCCaptionButton::IsMiniFrameButton

Indicates whether the title bar height is set to mini size.

CMFCCaptionButton::Move

Sets the button draw location and window show state.

CMFCCaptionButton::OnDraw

Draws the caption button.

CMFCCaptionButton::SetMiniFrameButton

Sets the mini size of the title bar.

Remarks

You can derive a class from CPaneFrameWnd Class and use the protected method, AddButton, to add caption buttons to a mini frame window.

CPaneFrameWnd.h defines command IDs for two types of caption buttons:

  • AFX_CAPTION_BTN_PIN, which displays a pin button when the docking pane supports auto-hide mode.

  • AFX_CAPTION_BTN_CLOSE, which displays a Close button when the pane can be closed or hidden.

Example

The following example demonstrates how to construct a CMFCCaptionButton object and set the mini size of the title bar.

  CMFCCaptionButton* captionButton = new CMFCCaptionButton(AFX_HTCLOSE);
    captionButton->SetMiniFrameButton(true);

Inheritance Hierarchy

CObject

   CMFCCaptionButton

Requirements

Header: afxcaptionbutton.h

See Also

Reference

Hierarchy Chart

CPaneFrameWnd Class

CDockablePane Class

Other Resources

MFC Classes