CComboBox::SetCueBanner
设置为组合框控件中显示的提示文本。
BOOL SetCueBanner(
LPCTSTR lpszText
);
参数
Parameter |
说明 |
---|---|
[in] lpszText |
对包含提示文本的Null终止的缓冲区的指针。 |
返回值
如果此方法成功,则为 true;否则为 false。
备注
提示文本位于组合框控件的输入区域中显示的提示。 提示文本显示,直到用户提供输入。
此方法发送 CB_SETCUEBANNER 信息,在 Windows SDK所述。
要求
标头: afxwin.h
此方法在 Windows Vista 和更高版本支持。
此方法的其他要求。Windows vista公共控件的生成要求所述。
示例
下面的代码示例定义任何变量,m_combobox,用于以编程方式访问组合框控件。 此变量在下一个示例。
// Variable to access the combo box control
CComboBox m_combobox;
下面的代码示例设置组合框控件的提示标题区。
// 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.