Creating a Rebar Control
CReBarCtrl objects should be created before the parent object is visible. This minimizes the possibilities of painting problems.
For instance, rebar controls (used in frame window objects) are commonly used as parent windows for toolbar controls. Therefore, the parent of the rebar control is the frame window object. Because the frame window object is the parent, the OnCreate member function (of the parent) is an excellent place to create the rebar control.
To use a CReBarCtrl object, you will typically follow these steps:
To use a CReBarCtrl object
Construct the CReBarCtrl object.
Call Create to create the Windows rebar common control and attach it to the CReBarCtrl object, specifying any desired styles.
Load a bitmap, with a call to CBitmap::LoadBitmap, to be used as the background of the rebar control object.
Create and initialize any child window objects (toolbars, dialog controls, and so on) that will be contained by the rebar control object.
Initialize a REBARBANDINFO structure with the necessary information for the band about to be inserted.
Call InsertBand to insert existing child windows (such as m_wndReToolBar) into the new rebar control. For more information on inserting bands into an existing rebar control, see Rebar Controls and Bands.