CReBarCtrl::SetBandWidth

设置指定的停靠的带区在变宽当前rebar控件的。

BOOL SetBandWidth(
     UINT uBand, 
     int cxWidth
);

参数

Parameter

说明

[in] uBand

rebar带区的从零开始的索引。

[in] cxWidth

rebar带区的新的宽度,像素为单位)。

返回值

如果此方法成功,则为 true;否则为 false。

备注

此方法发送 RB_SETBANDWIDTH 信息,在 Windows SDK所述。

要求

标头: afxcmn.h

此方法在 Windows Vista 和更高版本支持。

此方法的其他要求。Windows vista公共控件的生成要求所述。

示例

下面的代码示例定义任何变量,m_rebar,用于访问当前rebar控件。 此变量在下一个示例。

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

下面的代码示例将每rebar带区是相同的宽度。

    // 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选件类

层次结构图

RB_SETBANDWIDTH