Creating a Rebar Control


For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

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

  1. Construct the CReBarCtrl object.

  2. Call Create to create the Windows rebar common control and attach it to the CReBarCtrl object, specifying any desired styles.

  3. Load a bitmap, with a call to CBitmap::LoadBitmap, to be used as the background of the rebar control object.

  4. Create and initialize any child window objects (toolbars, dialog controls, and so on) that will be contained by the rebar control object.

  5. Initialize a REBARBANDINFO structure with the necessary information for the band about to be inserted.

  6. 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.

Using CReBarCtrl