description | title | ms.date | helpviewer_keywords | ms.assetid | ||
---|---|---|---|---|---|---|
Learn more about: Using an Image List with a Rebar Control |
Using an Image List with a Rebar Control |
11/04/2016 |
|
1a5836ac-019a-46aa-8741-b35c3376b839 |
Each rebar band can contain, among other things, an image from an associated image list. The following procedure details the necessary steps for displaying an image in a rebar band.
-
Attach an image list to your rebar control object by making a call to SetImageList, passing a pointer to an existing image list.
-
Modify the REBARBANDINFO structure to assign an image to a rebar band:
-
Set the fMask member to
RBBIM_IMAGE
, using the bitwise OR operator to include additional flags as necessary. -
Set the iImage member to the image list index of the image to be displayed.
-
-
Initialize any remaining data members, such as the size, text, and handle of the contained child window, with the necessary information.
-
Insert the new band (with the image) with a call to CReBarCtrl::InsertBand, passing the REBARBANDINFO structure.
The following example assumes that an existing image list object with two images was attached to the rebar control object (m_wndReBar
). A new rebar band (defined by rbi
), containing the first image, is added with a call to InsertBand
:
[!code-cppNVC_MFCControlLadenDialog#28]