CMFCReBar Class

A CMFCReBar object is a control bar that provides layout, persistence, and state information for rebar controls.

class CMFCReBar : public CPane

Members

Public Methods

Name

Description

CMFCReBar::AddBar

Adds a band to a rebar.

CMFCReBar::CalcFixedLayout

  (Overrides CBasePane::CalcFixedLayout.)

CMFCReBar::CanFloat

  (Overrides CBasePane::CanFloat.)

CMFCReBar::Create

Creates the rebar control and attaches it to the CMFCReBar object.

CMFCReBar::EnableDocking

  (Overrides CBasePane::EnableDocking.)

CMFCReBar::GetReBarBandInfoSize

 

CMFCReBar::GetReBarCtrl

Provides direct access to the underlying CReBarCtrl common control.

CMFCReBar::OnShowControlBarMenu

  (Overrides CPane::OnShowControlBarMenu.)

CMFCReBar::OnToolHitTest

  (Overrides CWnd::OnToolHitTest.)

CMFCReBar::OnUpdateCmdUI

  (Overrides CBasePane::OnUpdateCmdUI.)

CMFCReBar::SetPaneAlignment

  (Overrides CBasePane::SetPaneAlignment.)

Remarks

A CMFCReBar object can contain a variety of child windows. This includes edit boxes, toolbars, and list boxes. You can resize the rebar programmatically, or the user can manually resize the rebar by dragging its gripper bar. You can also set the background of a rebar object to a bitmap of your choice.

A rebar object behaves similarly to a toolbar object. A rebar control can contain one or more bands, and each band can contain a gripper bar, a bitmap, a text label, and a child window.

Example

The following example demonstrates how to use various methods in the CMFCReBar class. The example shows how to create a rebar control and add a band to it. The band functions as an internal toolbar. This code snippet is part of the Rebar Test sample.

    CMFCReBar               m_wndReBar;


...


    // Each rebar pane will ocupy its own row:
    DWORD dwStyle = RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP | RBBS_BREAK;
    // CMFCMenuBar m_wndMenuBar
    // CMFCToolBar m_wndToolBar
    if (!m_wndReBar.Create(this) ||
        !m_wndReBar.AddBar (&m_wndMenuBar) ||
        !m_wndReBar.AddBar (&m_wndToolBar, NULL, NULL, dwStyle))
    {
        TRACE0("Failed to create rebar\n");
        return -1;      // fail to create
    }

Inheritance Hierarchy

CObject   CCmdTarget      CWnd

         CBasePane            CPane               CMFCReBar

Requirements

Header: afxRebar.h

See Also

Reference

Hierarchy Chart

CReBarCtrl Class

CPane Class

Other Resources

MFC Classes