Partager via


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.

Requirements

Header: afxcmn.h

This method is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

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;

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

See Also

Concepts

CReBarCtrl Class

CReBarCtrl Members

Hierarchy Chart

RB_SETBANDWIDTH