CReBarCtrl Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

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.

class CReBarCtrl : public CWnd  

Public Constructors

NameDescription
CReBarCtrl::CReBarCtrlConstructs a CReBarCtrl object.

Public Methods

NameDescription
CReBarCtrl::BeginDragPlaces the rebar control into drag-and-drop mode.
CReBarCtrl::CreateCreates the rebar control and attaches it to the CReBarCtrl object.
CReBarCtrl::CreateExCreates a rebar control with the specified Windows extended styles and attaches it to a CReBarCtrl object.
CReBarCtrl::DeleteBandDeletes a band from a rebar control.
CReBarCtrl::DragMoveUpdates the drag position in the rebar control after a call to BeginDrag.
CReBarCtrl::EndDragTerminates the rebar control's drag-and-drop operation.
CReBarCtrl::GetBandBordersRetrieves the borders of a band.
CReBarCtrl::GetBandCountRetrieves the count of bands currently in the rebar control.
CReBarCtrl::GetBandInfoRetrieves information about a specified band in a rebar control.
CReBarCtrl::GetBandMarginsRetrieves the margins of a band.
CReBarCtrl::GetBarHeightRetrieves the height of the rebar control.
CReBarCtrl::GetBarInfoRetrieves information about the rebar control and the image list it uses.
CReBarCtrl::GetBkColorRetrieves a rebar control's default background color.
CReBarCtrl::GetColorSchemeRetrieves the COLORSCHEME structure associated with the rebar control.
CReBarCtrl::GetDropTargetRetrieves a rebar control's IDropTarget interface pointer.
CReBarCtrl::GetExtendedStyleGets the extended style of the current rebar control.
CReBarCtrl::GetImageListRetrieves the image list associated with a rebar control.
CReBarCtrl::GetPaletteRetrieves the rebar control's current palette.
CReBarCtrl::GetRectRetrieves the bounding rectangle for a given band in a rebar control.
CReBarCtrl::GetRowCountRetrieves the number of band rows in a rebar control.
CReBarCtrl::GetRowHeightRetrieves the height of a specified row in a rebar control.
CReBarCtrl::GetTextColorRetrieves a rebar control's default text color.
CReBarCtrl::GetToolTipsRetrieves the handle to any tool tip control associated with the rebar control.
CReBarCtrl::HitTestDetermines which portion of a rebar band is at a given point on the screen, if a rebar band exists at that point.
CReBarCtrl::IDToIndexConverts a band identifier (ID) to a band index in a rebar control.
CReBarCtrl::InsertBandInserts a new band in a rebar control.
CReBarCtrl::MaximizeBandResizes a band in a rebar control to its largest size.
CReBarCtrl::MinimizeBandResizes a band in a rebar control to its smallest size.
CReBarCtrl::MoveBandMoves a band from one index to another.
CReBarCtrl::PushChevronProgrammatically pushes a chevron.
CReBarCtrl::RestoreBandResizes a band in a rebar control to its ideal size.
CReBarCtrl::SetBandInfoSets characteristics of an existing band in a rebar control.
CReBarCtrl::SetBandWidthSets the width of the specified docked band in the current rebar control.
CReBarCtrl::SetBarInfoSets the characteristics of a rebar control.
CReBarCtrl::SetBkColorSets a rebar control's default background color.
CReBarCtrl::SetColorSchemeSets the color scheme for the buttons on a rebar control.
CReBarCtrl::SetExtendedStyleSets the extended styles for the current rebar control.
CReBarCtrl::SetImageListSets a rebar control's image list.
CReBarCtrl::SetOwnerSets a rebar control's owner window.
CReBarCtrl::SetPaletteSets the rebar control's current palette.
CReBarCtrl::SetTextColorSets a rebar control's default text color.
CReBarCtrl::SetToolTipsAssociates a tool tip control with the rebar control.
CReBarCtrl::SetWindowThemeSets the visual style of the rebar control.
CReBarCtrl::ShowBandShows or hides a given band in a rebar control.
CReBarCtrl::SizeToRectFits a rebar control to a specified rectangle.

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

CObject

CCmdTarget

CWnd

CReBarCtrl

Header: afxcmn.h

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.

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;   

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

Creates a CReBarCtrl object.

CReBarCtrl();

Example

See the example for CReBarCtrl::Create.

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);   

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.

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

void EndDrag();

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.

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.

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.

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.

Retrieves the height of the rebar bar.

UINT GetBarHeight() const;  

Return Value

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

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.

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.

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.

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.

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.

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.

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!"));   
      }

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);   

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);   

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);
      }   

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.

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.

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.

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.

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);      

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);   

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);   

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.

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.

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);   

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();
      }   

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

BOOL SetBandWidth(
    UINT uBand,   
    int cxWidth);

Parameters

ParameterDescription
[in] uBandZero-based index of a rebar band.
[in] cxWidthNew 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);

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);   

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.

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.

Sets the extended styles for the current rebar control.

DWORD SetExtendedStyle(
    DWORD dwMask,   
    DWORD dwStyleEx);

Parameters

ParameterDescription
[in] dwMaskA 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] dwStyleExA 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.

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.

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.

System_CAPS_ICON_note.jpg 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.

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.

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.

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.

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.

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.

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.

CWnd Class
Hierarchy Chart

Show: