将字符串添加到MFC ComboBox [英] Add strings to MFC ComboBox

查看:470
本文介绍了将字符串添加到MFC ComboBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在尝试向ComboBox添加字符串:

Trying to add strings to ComboBox:

BOOL CMyAppDlg::OnInitDialog()
{

    CComboBox *combo= (CComboBox *)GetDlgItem(IDC_COMBO_TT);
    combo->AddString("s1");
    combo->AddString("s2");

    // ...
    return TRUE;
}

为什么ComboBox列表仍为空?

Why ComboBox list is still empty?

推荐答案

如果你调用combo-> SetCurSel(0),你看到第一个字符串吗?如果是这样,意味着组合框下拉大小为零。在视觉对话框编辑器中单击组合的向下箭头,然后将底部边缘向下拖动以调整下拉部分的大小。

Do you see the first string if you call combo->SetCurSel(0)? If so it means the combo box drop down size is zero. In the visual dialog editor click on the combo's down arrow then drag the bottom edge down to resize the drop down part.

这篇关于将字符串添加到MFC ComboBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆