Share via


CReBarCtrl Class

 

The latest version of this topic can be found at CReBarCtrl Class.

Encapsulates the functionality of a rebar control, which is a container for a child window.

Syntax

class CReBarCtrl : public CWnd  

Members

Public Constructors

Name Description
CReBarCtrl::CReBarCtrl Constructs a CReBarCtrl object.

Public Methods

Name Description
CReBarCtrl::BeginDrag Places the rebar control into drag-and-drop mode.
CReBarCtrl::Create Creates the rebar control and attaches it to the CReBarCtrl object.
CReBarCtrl::CreateEx Creates a rebar control with the specified Windows extended styles and attaches it to a CReBarCtrl object.
CReBarCtrl::DeleteBand Deletes a band from a rebar control.
CReBarCtrl::DragMove Updates the drag position in the rebar control after a call to BeginDrag.
CReBarCtrl::EndDrag Terminates the rebar control's drag-and-drop operation.
CReBarCtrl::GetBandBorders Retrieves the borders of a band.
CReBarCtrl::GetBandCount Retrieves the count of bands currently in the rebar control.
CReBarCtrl::GetBandInfo Retrieves information about a specified band in a rebar control.
CReBarCtrl::GetBandMargins Retrieves the margins of a band.
CReBarCtrl::GetBarHeight Retrieves the height of the rebar control.
CReBarCtrl::GetBarInfo Retrieves information about the rebar control and the image list it uses.
CReBarCtrl::GetBkColor Retrieves a rebar control's default background color.
CReBarCtrl::GetColorScheme Retrieves the COLORSCHEME structure associated with the rebar control.
CReBarCtrl::GetDropTarget Retrieves a rebar control's IDropTarget interface pointer.
CReBarCtrl::GetExtendedStyle Gets the extended style of the current rebar control.
CReBarCtrl::GetImageList Retrieves the image list associated with a rebar control.
CReBarCtrl::GetPalette Retrieves the rebar control's current palette.
CReBarCtrl::GetRect Retrieves the bounding rectangle for a given band in a rebar control.
CReBarCtrl::GetRowCount Retrieves the number of band rows in a rebar control.
CReBarCtrl::GetRowHeight Retrieves the height of a specified row in a rebar control.
CReBarCtrl::GetTextColor Retrieves a rebar control's default text color.
CReBarCtrl::GetToolTips Retrieves the handle to any tool tip control associated with the rebar control.
CReBarCtrl::HitTest Determines which portion of a rebar band is at a given point on the screen, if a rebar band exists at that point.
CReBarCtrl::IDToIndex Converts a band identifier (ID) to a band index in a rebar control.
CReBarCtrl::InsertBand Inserts a new band in a rebar control.
CReBarCtrl::MaximizeBand Resizes a band in a rebar control to its largest size.
CReBarCtrl::MinimizeBand Resizes a band in a rebar control to its smallest size.
CReBarCtrl::MoveBand Moves a band from one index to another.
CReBarCtrl::PushChevron Programmatically pushes a chevron.
CReBarCtrl::RestoreBand Resizes a band in a rebar control to its ideal size.
CReBarCtrl::SetBandInfo Sets characteristics of an existing band in a rebar control.
CReBarCtrl::SetBandWidth Sets the width of the specified docked band in the current rebar control.
CReBarCtrl::SetBarInfo Sets the characteristics of a rebar control.
CReBarCtrl::SetBkColor Sets a rebar control's default background color.
CReBarCtrl::SetColorScheme Sets the color scheme for the buttons on a rebar control.
CReBarCtrl::SetExtendedStyle Sets the extended styles for the current rebar control.
CReBarCtrl::SetImageList Sets a rebar control's image list.
CReBarCtrl::SetOwner Sets a rebar control's owner window.
CReBarCtrl::SetPalette Sets the rebar control's current palette.
CReBarCtrl::SetTextColor Sets a rebar control's default text color.
CReBarCtrl::SetToolTips Associates a tool tip control with the rebar control.
CReBarCtrl::SetWindowTheme Sets the visual style of the rebar control.
CReBarCtrl::ShowBand Shows or hides a given band in a rebar control.
CReBarCtrl::SizeToRect Fits a rebar control to a specified rectangle.

Remarks

The application in which the rebar control resides assigns the child window contained by the rebar control to the rebar band. The child window is usually another common control.

Rebar controls contain one or more bands. Each band can contain a combination of a gripper bar, a bitmap, a text label, and a child window. The band can contain only one of each of these items.

The rebar control can display the child window over a specified background bitmap. All rebar control bands can be resized, except those that use the RBBS_FIXEDSIZE style. As you reposition or resize a rebar control band, the rebar control manages the size and position of the child window assigned to that band. To resize or change the order of bands within the control, click and drag a band's gripper bar.

The following illustration shows a rebar control that has three bands:

  • Band 0 contains a flat, transparent toolbar control.

  • Band 1 contains both transparent standard and transparent dropdown buttons.

  • Band 2 contains a combo box and four standard buttons.

    Example of a Rebar menu

Rebar control

Rebar controls support:

  • Image lists.

  • Message-handling.

  • Custom draw functionality.

  • A variety of control styles in addition to standard window styles. For a list of these styles, see Rebar Control Styles in the Windows SDK.

For more information, see Using CReBarCtrl.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CReBarCtrl

Requirements

Header: afxcmn.h

CReBarCtrl::BeginDrag

Implements the behavior of the Win32 message RB_BEGINDRAG, as described in the Windows SDK.

void BeginDrag(
    UINT uBand,  
    DWORD dwPos = (DWORD)-1);

Parameters

uBand
Zero-based index of the band that the drag-and-drop operation will affect.

dwPos
A DWORD value that contains the starting mouse coordinates. The horizontal coordinate is contained in the LOWORD and the vertical coordinate is contained in the HIWORD. If you pass (DWORD)-1, the rebar control will use the position of the mouse the last time the control's thread called GetMessage or PeekMessage.

CReBarCtrl::Create

Creates the rebar control and attaches it to the CReBarCtrl object.

virtual BOOL Create(
    DWORD dwStyle,  
    const RECT& rect,  
    CWnd* pParentWnd,  
    UINT nID);

Parameters

dwStyle
Specifies the combination of rebar control styles applied to the control. See Rebar Control Styles in the Windows SDK for a list of supported styles.

rect
A reference to a CRect object or RECT structure, which is the position and size of the rebar control.

pParentWnd
A pointer to a CWnd object that is the parent window of the rebar control. It must not be NULL.

nID
Specifies the rebar control's control ID.

Return Value

Nonzero if the object was created successfully; otherwise 0.

Remarks

Create a rebar control in two steps:

  1. Call CReBarCtrl to construct a CReBarCtrl object.

  2. Call this member function, which creates the Windows rebar control and attaches it to the CReBarCtrl object.

When you call Create, the common controls are initialized.

Example

      CReBarCtrl* pReBarCtrl = new CReBarCtrl();
      CRect rect;
      GetWindowRect(rect);
      pReBarCtrl->Create(RBS_BANDBORDERS, rect, this, AFX_IDW_REBAR);

      // Use ReBar Control.

      delete pReBarCtrl;   

CReBarCtrl::CreateEx

Creates a control (a child window) and associates it with the CReBarCtrl object.

virtual BOOL CreateEx(
    DWORD dwExStyle,  
    DWORD dwStyle,  
    const RECT& rect,  
    CWnd* pParentWnd,  
    UINT nID);

Parameters

dwExStyle
Specifies the extended style of the control being created. For a list of extended Windows styles, see the dwExStyle parameter for CreateWindowEx in the Windows SDK.

dwStyle
Specifies the combination of rebar control styles applied to the control. For a list of supported styles, see Rebar Control Styles in the Windows SDK.

rect
A reference to a RECT structure describing the size and position of the window to be created, in client coordinates of pParentWnd.

pParentWnd
A pointer to the window that is the control's parent.

nID
The control's child-window ID.

Return Value

Nonzero if successful; otherwise 0.

Remarks

Use CreateEx instead of Create to apply extended Windows styles, specified by the Windows extended style preface WS_EX_.

CReBarCtrl::CReBarCtrl

Creates a CReBarCtrl object.

CReBarCtrl();

Example

See the example for CReBarCtrl::Create.

CReBarCtrl::DeleteBand

Implements the behavior of the Win32 message RB_DELETEBAND, as described in the Windows SDK.

BOOL DeleteBand(UINT uBand);

Parameters

uBand
Zero-based index of the band to be deleted.

Return Value

Nonzero if the band deleted successfully; otherwise zero.

Example

      UINT nCount = m_wndReBar.GetReBarCtrl().GetBandCount();

      if (nCount > 0)
         m_wndReBar.GetReBarCtrl().DeleteBand(nCount - 1);   

CReBarCtrl::DragMove

Implements the behavior of the Win32 message RB_DRAGMOVE, as described in the Windows SDK.

void DragMove(DWORD dwPos = (DWORD)-1);

Parameters

dwPos
A DWORD value that contains the new mouse coordinates. The horizontal coordinate is contained in the LOWORD and the vertical coordinate is contained in the HIWORD. If you pass (DWORD)-1, the rebar control will use the position of the mouse the last time the control's thread called GetMessage or PeekMessage.

CReBarCtrl::EndDrag

Implements the behavior of the Win32 message RB_ENDDRAG, as described in the Windows SDK.

void EndDrag();

CReBarCtrl::GetBandBorders

Implements the behavior of the Win32 message RB_GETBANDBORDERS, as described in the Windows SDK.

void GetBandBorders(
    UINT uBand,  
    LPRECT prc) const;  

Parameters

uBand
Zero-based index of the band for which the borders will be retrieved.

prc
A pointer to a RECT structure that will receive the band borders. If the rebar control has the RBS_BANDBORDERS style, each member of this structure will receive the number of pixels, on the corresponding side of the band, that constitute the border. If the rebar control does not have the RBS_BANDBORDERS style, only the left member of this structure receives valid information. For a description of rebar control styles, see Rebar Control Styles in the Windows SDK.

CReBarCtrl::GetBandCount

Implements the behavior of the Win32 message RB_GETBANDCOUNT, as described in the Windows SDK.

UINT GetBandCount() const;  

Return Value

The number of bands assigned to the control.

CReBarCtrl::GetBandInfo

Implements the behavior of the Win32 message RB_GETBANDINFO as described in the Windows SDK.

BOOL GetBandInfo(
    UINT uBand,  
    REBARBANDINFO* prbbi) const;  

Parameters

uBand
Zero-based index of the band for which the information will be retrieved.

prbbi
A pointer to a REBARBANDINFO structure to receive the band information. You must set the cbSize member of this structure to sizeof(REBARBANDINFO) and set the fMask member to the items you want to retrieve before sending this message.

Return Value

Nonzero if successful; otherwise zero.

CReBarCtrl::GetBandMargins

Retrieves the margins of the band.

void GetBandMargins(PMARGINS pMargins);

Parameters

pMargins
A pointer to a MARGINSstructure that will receive the information.

Remarks

This member function emulates the functionality of the RB_GETBANDMARGINS message, as described in the Windows SDK.

CReBarCtrl::GetBarHeight

Retrieves the height of the rebar bar.

UINT GetBarHeight() const;  

Return Value

Value that represents the height, in pixels, of the control.

CReBarCtrl::GetBarInfo

Implements the behavior of the Win32 message RB_GETBARINFO, as described in the Windows SDK.

BOOL GetBarInfo(REBARINFO* prbi) const;  

Parameters

prbi
A pointer to a REBARINFO structure that will receive the rebar control information. You must set the cbSize member of this structure to sizeof(REBARINFO) before sending this message.

Return Value

Nonzero if successful; otherwise zero.

CReBarCtrl::GetBkColor

Implements the behavior of the Win32 message RB_GETBKCOLOR, as described in the Windows SDK.

COLORREF GetBkColor() const;  

Return Value

A COLORREF value that represent the current default background color.

CReBarCtrl::GetColorScheme

Retrieves the COLORSCHEME structure for the rebar control.

BOOL GetColorScheme(COLORSCHEME* lpcs);

Parameters

lpcs
A pointer to a COLORSCHEME structure, as described in the Windows SDK.

Return Value

Nonzero if successful; otherwise zero.

Remarks

The COLORSCHEME structure includes the button highlight color and the button shadow color.

CReBarCtrl::GetDropTarget

Implements the behavior of the Win32 message RB_GETDROPTARGET, as described in the Windows SDK.

IDropTarget* GetDropTarget() const;  

Return Value

A pointer to an IDropTarget interface.

CReBarCtrl::GetExtendedStyle

Gets the extended styles of the current rebar control.

DWORD GetExtendedStyle() const;  

Return Value

A bitwise combination (OR) of flags that indicate the extended styles. The possible flags are RBS_EX_SPLITTER and RBS_EX_TRANSPARENT. For more information, see the dwMask parameter of the CReBarCtrl::SetExtendedStyle method.

Remarks

This method sends the RB_GETEXTENDEDSTYLE message, which is described in the Windows SDK.

CReBarCtrl::GetImageList

Gets the CImageList object associated with a rebar control.

CImageList* GetImageList() const;  

Return Value

A pointer to a CImageList object. Returns NULL if no image list is set for the control.

Remarks

This member function uses size and mask information stored in the REBARINFO structure, as described in the Windows SDK.

CReBarCtrl::GetPalette

Retrieves the rebar control's current palette.

CPalette* GetPalette() const;  

Return Value

A pointer to a CPalette object specifying the rebar control's current palette.

Remarks

Note that this member function uses a CPalette object as its return value, rather than an HPALETTE.

Example

      CPalette* pPalette = m_wndReBar.GetReBarCtrl().GetPalette();
      if (pPalette)
      {
         int nEntries = pPalette->GetEntryCount();
         CString msg;
         msg.Format(_T("Number of palette entries: %d"), nEntries);
         AfxMessageBox(msg);
      }
      else
      {
         AfxMessageBox(_T("No palette!"));   
      }

CReBarCtrl::GetRect

Implements the behavior of the Win32 message RB_GETRECT, as described in the Windows SDK.

BOOL GetRect(
    UINT uBand,  
    LPRECT prc) const;  

Parameters

uBand
Zero-based index of a band in the rebar control.

prc
A pointer to a RECT structure that will receive the bounds of the rebar band.

Return Value

Nonzero if successful; otherwise zero.

Example

      CRect rc;
      m_wndReBar.GetReBarCtrl().GetRect(0, &rc);
      CString msg;
      msg.Format(_T("rect.left = %d, rect.top = %d, ")
          _T("rect.right = %d, rect.bottom = %d"), rc.left,
          rc.top, rc.right, rc.bottom);
      AfxMessageBox(msg);   

CReBarCtrl::GetRowCount

Implements the behavior of the Win32 message RB_GETROWCOUNT, as described in the Windows SDK.

UINT GetRowCount() const;  

Return Value

A UINT value that represents the number of band rows in the control.

Example

      UINT nRowCount = m_wndReBar.GetReBarCtrl().GetRowCount();
      CString msg;
      msg.Format(_T("Row Count is %d"), nRowCount);
      AfxMessageBox(msg);   

CReBarCtrl::GetRowHeight

Implements the behavior of the Win32 message RB_GETROWHEIGHT, as described in the Windows SDK.

UINT GetRowHeight(UINT uRow) const;  

Parameters

uRow
Zero-based index of the band that will have its height retrieved.

Return Value

A UINT value that represents the row height, in pixels.

Example

      int nCount = m_wndReBar.GetReBarCtrl().GetRowCount();
      for (int i = 0; i < nCount; i++)
      {
         UINT nHeight = m_wndReBar.GetReBarCtrl().GetRowHeight(i);
         CString msg;
         msg.Format(_T("Height of row %d is %u"), i, nHeight);
         AfxMessageBox(msg);
      }   

CReBarCtrl::GetTextColor

Implements the behavior of the Win32 message RB_GETTEXTCOLOR, as described in the Windows SDK.

COLORREF GetTextColor() const;  

Return Value

A COLORREF value that represent the current default text color.

CReBarCtrl::GetToolTips

Implements the behavior of the Win32 message RB_GETTOOLTIPS, as described in the Windows SDK.

CToolTipCtrl* GetToolTips() const;  

Return Value

A pointer to a CToolTipCtrl object.

Remarks

Note that the MFC implementation of GetToolTips returns a pointer to a CToolTipCtrl, rather than an HWND.

CReBarCtrl::HitTest

Implements the behavior of the Win32 message RB_HITTEST, as described in the Windows SDK.

int HitTest(RBHITTESTINFO* prbht);

Parameters

prbht
A pointer to a RBHITTESTINFO structure. Before sending the message, the pt member of this structure must be initialized to the point that will be tested, in client coordinates.

Return Value

The zero-based index of the band at the given point, or -1 if no rebar band was at the point.

CReBarCtrl::IDToIndex

Implements the behavior of the Win32 message RB_IDTOINDEX, as described in the Windows SDK.

int IDToIndex(UINT uBandID) const;  

Parameters

uBandID
The application-defined identifier of the specified band, passed in the wID member of the REBARBANDINFO structure when the band is inserted.

Return Value

The zero-based band index if successful, or -1 otherwise. If duplicate band indices exist, the first one is returned.

CReBarCtrl::InsertBand

Implements the behavior of the Win32 message RB_INSERTBAND, as described in the Windows SDK.

BOOL InsertBand(
    UINT uIndex,  
    REBARBANDINFO* prbbi);

Parameters

uIndex
Zero-based index of the location where the band will be inserted. If you set this parameter to -1, the control will add the new band at the last location.

prbbi
A pointer to a REBARBANDINFO structure that defines the band to be inserted. You must set the cbSize member of this structure to sizeof(REBARBANDINFO) before calling this function.

Return Value

Nonzero if successful; otherwise zero.

Example

      REBARBANDINFO rbbi = {0};
      rbbi.cbSize = sizeof(rbbi);

      TCHAR szText[80];
      rbbi.lpText = szText;
      rbbi.cch = sizeof(szText) / sizeof(szText[0]);

      rbbi.fMask = RBBIM_BACKGROUND | RBBIM_CHILD |
          RBBIM_CHILDSIZE | RBBIM_COLORS | RBBIM_HEADERSIZE |
          RBBIM_IDEALSIZE | RBBIM_ID | RBBIM_IMAGE |
          RBBIM_LPARAM | RBBIM_SIZE | RBBIM_STYLE | RBBIM_TEXT;

      m_wndReBar.GetReBarCtrl().GetBandInfo(0, &rbbi);

      m_wndReBar.GetReBarCtrl().InsertBand(1, &rbbi);      

CReBarCtrl::MaximizeBand

Resizes a band in a rebar control to its largest size.

void MaximizeBand(UINT uBand);

Parameters

uBand
Zero-based index of the band to be maximized.

Remarks

Implements the behavior of the Win32 message RB_MAXIMIZEBAND with fIdeal set to 0, as described in the Windows SDK.

Example

      CReBarCtrl& refReBarCtrl = m_wndReBar.GetReBarCtrl();
      UINT nCount = refReBarCtrl.GetBandCount();

      for (UINT i = 0; i < nCount; i++)
         refReBarCtrl.MaximizeBand(i);   

CReBarCtrl::MinimizeBand

Resizes a band in a rebar control to its smallest size.

void MinimizeBand(UINT uBand);

Parameters

uBand
Zero-based index of the band to be minimized.

Remarks

Implements the behavior of the Win32 message RB_MINIMIZEBAND, as described in the Windows SDK.

Example

      CReBarCtrl& refReBarCtrl = m_wndReBar.GetReBarCtrl();
      UINT nCount = refReBarCtrl.GetBandCount();

      for (UINT i = 0; i < nCount; i++)
         refReBarCtrl.MinimizeBand(i);   

CReBarCtrl::MoveBand

Implements the behavior of the Win32 message RB_MOVEBAND, as described in the Windows SDK.

BOOL MoveBand(
    UINT uFrom,  
    UINT uTo);

Parameters

uFrom
Zero-based index of the band to be moved.

uTo
Zero-based index of the new band position. This parameter value must never be greater than the number of bands minus one. To obtain the number of bands, call GetBandCount.

Return Value

Nonzero if successful; otherwise zero.

CReBarCtrl::PushChevron

Implements the behavior of the Win32 message RB_PUSHCHEVRON, as described in the Windows SDK.

void PushChevron(
    UINT uBand,  
    LPARAM lAppValue);

Parameters

uBand
Zero-based index of the band whose chevron is to be pushed.

lAppValue
An application defined 32-bit value. See lAppValue in RB_PUSHCHEVRON in the Windows SDK.

CReBarCtrl::RestoreBand

Resizes a band in a rebar control to its ideal size.

void RestoreBand(UINT uBand);

Parameters

uBand
Zero-based index of the band to be maximized.

Remarks

Implements the behavior of the Win32 message RB_MAXIMIZEBAND with fIdeal set to 1, as described in the Windows SDK.

Example

      CReBarCtrl& refReBarCtrl = m_wndReBar.GetReBarCtrl();
      UINT nCount = refReBarCtrl.GetBandCount();

      for (UINT i = 0; i < nCount; i++)
         refReBarCtrl.RestoreBand(i);   

CReBarCtrl::SetBandInfo

Implements the behavior of the Win32 message RB_SETBANDINFO, as described in the Windows SDK.

BOOL SetBandInfo(
    UINT uBand,  
    REBARBANDINFO* prbbi);

Parameters

uBand
Zero-based index of the band to receive the new settings.

prbbi
Pointer to a REBARBANDINFO structure that defines the band to be inserted. You must set the cbSize member of this structure to sizeof(REBARBANDINFO) before sending this message.

Return Value

Nonzero if successful; otherwise zero.

Example

      int nCount = m_wndReBar.GetReBarCtrl().GetBandCount();
      CString strText;
      REBARBANDINFO rbbi = {0};
      rbbi.cbSize = sizeof(rbbi);
      for (int i = 0; i < nCount; i++)
      {
         strText.Format(_T("Band #: %d"), i);
         rbbi.lpText = strText.GetBuffer();
         rbbi.cch = strText.GetLength() + 1;
         rbbi.fMask = RBBIM_TEXT;

         m_wndReBar.GetReBarCtrl().SetBandInfo(i, &rbbi);

         strText.ReleaseBuffer();
      }   

CReBarCtrl::SetBandWidth

Sets the width of the specified docked band in the current rebar control.

BOOL SetBandWidth(
    UINT uBand,   
    int cxWidth);

Parameters

Parameter Description
[in] uBand Zero-based index of a rebar band.
[in] cxWidth New width of the rebar band, in pixels.

Return Value

true if the method is successful; otherwise, false.

Remarks

This method sends the RB_SETBANDWIDTH message, which is described in the Windows SDK.

Example

The following code example defines the variable, m_rebar, that is used to access the current rebar control. This variable is used in the next example.

public:
    CReBarCtrl m_rebar;
    BOOL bRet;
    static const int TOTAL_BANDS = 5;
    static const int BUFFER_SIZE = 10;

Example

The following code example sets each rebar band to be the same width.

   // Set the width of each band.
    m_rebar.GetClientRect( &rect );
    int iWidth = rect.Width()/TOTAL_BANDS;
    for (int iIndex=0; iIndex < TOTAL_BANDS; iIndex++)
        bRet = m_rebar.SetBandWidth(iIndex, iWidth);

CReBarCtrl::SetBarInfo

Implements the behavior of the Win32 message RB_SETBARINFO, as described in the Windows SDK.

BOOL SetBarInfo(REBARINFO* prbi);

Parameters

prbi
A pointer to a REBARINFO structure that contains the information to be set. You must set the cbSize member of this structure to sizeof(REBARINFO) before sending this message

Return Value

Nonzero if successful; otherwise zero.

Example

      REBARINFO rbi = {0};
      rbi.cbSize = sizeof(REBARINFO);
      rbi.fMask = 0;
      rbi.himl = 0;
      m_wndReBar.GetReBarCtrl().SetBarInfo(&rbi);   

CReBarCtrl::SetBkColor

Implements the behavior of the Win32 message RB_SETBKCOLOR, as described in the Windows SDK.

COLORREF SetBkColor(COLORREF clr);

Parameters

clr
The COLORREF value that represents the new default background color.

Return Value

A COLORREF value that represents the previous default background color.

Remarks

See this topic for more information about when to set the background color, and how to set the default.

CReBarCtrl::SetColorScheme

Sets the color scheme for the buttons on a rebar control.

void SetColorScheme(const COLORSCHEME* lpcs);

Parameters

lpcs
A pointer to a COLORSCHEME structure, as described in the Windows SDK.

Remarks

The COLORSCHEME structure includes both the button highlight color and the button shadow color.

CReBarCtrl::SetExtendedStyle

Sets the extended styles for the current rebar control.

DWORD SetExtendedStyle(
    DWORD dwMask,   
    DWORD dwStyleEx);

Parameters

Parameter Description
[in] dwMask A bitwise combination (OR) of flags that specify which flags in the dwStyleEx parameter apply. Use one or more of the following values:

RBS_EX_SPLITTER: By default, show the splitter on the bottom in horizontal mode, and to the right in vertical mode.

RBS_EX_TRANSPARENT: Forward the WM_ERASEBKGND message to the parent window.
[in] dwStyleEx A bitwise combination (OR) of flags that specify the styles to apply. To set a style, specify the same flag that is used in the dwMask parameter. To reset a style, specify binary zero.

Return Value

The previous extended style.

Remarks

This method sends the RB_SETEXTENDEDSTYLE message, which is described in the Windows SDK.

CReBarCtrl::SetImageList

Assigns an image list to a rebar control.

BOOL SetImageList(CImageList* pImageList);

Parameters

pImageList
A pointer to a CImageList object containing the image list to be assigned to the rebar control.

Return Value

Nonzero if successful; otherwise zero.

CReBarCtrl::SetOwner

Implements the behavior of the Win32 message RB_SETPARENT, as described in the Windows SDK.

CWnd* SetOwner(CWnd* pWnd);

Parameters

pWnd
A pointer to a CWnd object to set as the owner of the rebar control.

Return Value

A pointer to a CWnd object that is the current owner of the rebar control.

Remarks

Note that this member function uses pointers to CWnd objects for both the current and selected owner of the rebar control, rather than handles to windows.

Note

This member function does not change the actual parent that was set when the control was created; rather it sends notification messages to the window you specify.

CReBarCtrl::SetPalette

Implements the behavior of the Win32 message RB_SETPALETTE, as described in the Windows SDK.

CPalette* SetPalette(HPALETTE hPal);

Parameters

hPal
An HPALETTE that specifies the new palette that the rebar control will use.

Return Value

A pointer to a CPalette object specifying the rebar control's previous palette.

Remarks

Note that this member function uses a CPalette object as its return value, rather than an HPALETTE.

CReBarCtrl::SetTextColor

Implements the behavior of the Win32 message RB_SETTEXTCOLOR, as described in the Windows SDK.

COLORREF SetTextColor(COLORREF clr);

Parameters

clr
A COLORREF value that represents the new text color in the CReBarCtrl object.

Return Value

The COLORREF value representing the previous text color associated with the CReBarCtrl object.

Remarks

It is provided to support text color flexibility in a rebar control.

CReBarCtrl::SetToolTips

Associates a tool tip control with a rebar control.

void SetToolTips(CToolTipCtrl* pToolTip);

Parameters

pToolTip
A pointer to a CToolTipCtrl object

Remarks

You must destroy the CToolTipCtrl object when you are done with it.

CReBarCtrl::SetWindowTheme

Sets the visual style of the rebar control.

HRESULT SetWindowTheme(LPCWSTR pszSubAppName);

Parameters

pszSubAppName
A pointer to a Unicode string that contains the rebar visual style to set.

Return Value

The return value is not used.

Remarks

This member function emulates the functionality of the RB_SETWINDOWTHEME message, as described in the Windows SDK.

CReBarCtrl::ShowBand

Implements the behavior of the Win32 message RB_SHOWBAND, as described in the Windows SDK.

BOOL ShowBand(
    UINT uBand,  
    BOOL fShow = TRUE);

Parameters

uBand
Zero-based index of a band in the rebar control.

fShow
Indicates if the band should be shown or hidden. If this value is TRUE, the band will be shown. Otherwise, the band will be hidden.

Return Value

Nonzero if successful; otherwise zero.

CReBarCtrl::SizeToRect

Implements the behavior of the Win32 message RB_SIZETORECT, as described in the Windows SDK.

BOOL SizeToRect(CRect& rect);

Parameters

rect
A reference to a CRect object that specifies the rectangle that the rebar control should be sized to.

Return Value

Nonzero if successful; otherwise zero.

Remarks

Note that this member function uses a CRect object as a parameter, rather than a RECT structure.

See Also

CWnd Class
Hierarchy Chart