请单击以进行评分并提供反馈
MSDN
MSDN Library
Visual Studio
Visual C++
MFC
MFC Concepts
User Interface
Controls (MFC)
Using CReBarCtrl
 Using an Image List with a Rebar Co...

  开启低带宽视图
此页面仅适用于
Microsoft Visual Studio 2008/.NET Framework 3.5

同时提供下列产品的其他版本:
MFC Library Reference
Using an Image List with a Rebar Control

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.

To display images in a rebar band

  1. Attach an image list to your rebar control object by making a call to SetImageList, passing a pointer to an existing image list.

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

  3. Initialize any remaining data members, such as the size, text, and handle of the contained child window, with the necessary information.

  4. 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:

Visual C++
REBARBANDINFO rbi = {0};
rbi.cbSize = sizeof(REBARBANDINFO);
rbi.fMask = RBBIM_BACKGROUND | RBBIM_CHILD | RBBIM_IMAGE | 
   RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_TEXT;
rbi.fStyle = RBBS_GRIPPERALWAYS;
rbi.cxMinChild = 200;
rbi.cyMinChild = 50;
rbi.lpText = _T("Band #2");
rbi.cch = 7;
rbi.cx = 300;
rbi.hbmBack = (HBITMAP)m_RebarBitmap;
rbi.iImage = 0;
rbi.hwndChild = (HWND)m_Toolbar2;
m_Rebar.GetReBarCtrl().InsertBand(1, &rbi);    

社区内容   什么是社区内容?
添加新内容 RSS  批注
Processing
© 2009 Microsoft Corporation 版权所有。 保留所有权利  |  商标  |  隐私权声明
Page view tracker