Rebar Controls and Bands
The main purpose of a rebar control is to act as a container for child windows, common dialog controls, menus, toolbars, and so on. This containment is supported by the concept of a "band." Each rebar band can contain any combination of a gripper bar, a bitmap, a text label, and a child window.
Class CReBarCtrl has many member functions that you can use to retrieve, and manipulate, information for a specific rebar band:
GetBandCount Retrieves the number of current bands in the rebar control.
GetRect Retrieves the bounding rectangle of a specified band.
GetRowCount Retrieves the number of band rows in a rebar control.
IDToIndex Retrieves the index of a specified band.
GetBandBorders Retrieves the borders of a band.
In addition to manipulation, several member functions are provided that allow you to operate on specific rebar bands.
InsertBand and DeleteBand add and remove rebar bands. MinimizeBand and MaximizeBand affect the current size of a specific rebar band. MoveBand changes the index of a specific rebar band. ShowBand shows or hides a rebar band from the user.
The following example demonstrates adding a toolbar band (m_wndToolBar) to an existing rebar control (m_wndReBar). The band is described by initializing the rbi structure and then calling the InsertBand member function:
//load bitmap for toolbar background m_bmap.LoadBitmap(IDB_BITMAP); //create a toolbar band m_wndToolBar.Create(this, TBSTYLE_TRANSPARENT | TBSTYLE_FLAT); m_wndToolBar.LoadToolBar(IDR_MAINFRAME); REBARBANDINFO rbi; rbi.cbSize= sizeof(REBARBANDINFO); rbi.fMask= RBBIM_BACKGROUND | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_TEXT; rbi.fStyle= RBBS_GRIPPERALWAYS; rbi.cxMinChild= 300; rbi.cyMinChild= 30; rbi.lpText= "Band #1"; rbi.cch= 7; rbi.cx= 300; rbi.hbmBack= (HBITMAP)m_bmap; rbi.hwndChild= (HWND)m_wndToolBar; m_wndReBar.InsertBand(-1, &rbi);