CComboBox::SetMinVisibleItems

设置可见项的最小值在下拉列表当前组合框控件。

BOOL SetMinVisibleItems(
     int iMinVisible
);

参数

Parameter

说明

[in] iMinVisible

指定可见项的最小值。

返回值

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

要求

标头: afxwin.h

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

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

备注

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

示例

下面的代码示例定义任何变量,m_combobox,用于以编程方式访问组合框控件。 此变量在下一个示例。

    // Variable to access the combo box control
    CComboBox m_combobox;

下面的代码示例插入20个项添加到中组合框的下拉列表控件。 然后它指定至少10个项显示,当用户按下拉箭头时。

    // Add extra initialization here.

    // Add 20 items to the combo box. The Resource Editor
    // has already been used to set the style of the combo
    // box to CBS_SORT.
    CString str;
    for (int i = 1; i <= 20; i++)
    {
        str.Format(_T("Item %2d"), i); 
        m_combobox.AddString(str);
    }
    // Set the minimum visible item
    m_combobox.SetMinVisibleItems( 10 );
    // Set the cue banner
    m_combobox.SetCueBanner(_T("Select an item..."));

    // End of extra initialization.

请参见

参考

CComboBox选件类

层次结构图

CComboBox::GetMinVisible

CComboBox::ShowDropDown

CB_SETMINVISIBLE