请教一个关于Combo Box的问题
如果Type 设为Dropdown,则可通过SetWindowText()来设置Combo Box的编辑框的内容,但用户可更改框中的内容。
若将Type 设为Drop List,则不能通过SetWindowText()来设置Combo Box的编辑框的内容,有没有其他函数?
谢谢!
将Type 设为Drop List
IDC_COMBO1控制变量为m_combo;
m_combo.AddString("中国");
m_combo.AddString("美国");
..........
//选择第几个
m_combo.SetCurSel(输入你的数字);
//得到当前选择的字串
CString str;
m_combo.GetWindowText (str);
//得到任意一项字串
int GetLBText(int nIndex,LPTSTR lpszText) const;
m_combo.GetLBText (2,str);//是得到第三个的字串,都是从0开始记数的
好像没有直接的函数,估计只能先AddString()或者InsertString()后,然后用SetCurSel()或者SelectString()将其选中至编辑框中