在我的组合框中输入数据
我觉得问这个问题真的很傻,但是如何将数据添加到组合框?就像我想将 A、B 和 C 显示为我的保管箱字符串,但我已经尝试了很多东西,但我的组合框仍然不显示任何内容。
我尝试使用 A;B;C 设置“数据”属性。但它仍然没有显示这一点。
我在 Oninitdialog() 函数中尝试了这个:
CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_SENSOR_LIST);
CString string;
for(int i=0;i<10; i++)
{
string.Format("String %d", ++i);
pComboBox->AddString(string);
}
.. 仍然没有变化。也许我没有做一些真正愚蠢的事情,但目前无法弄清楚。请帮忙。
干杯。
I feel really silly asking this question but how do you add any data to a Combo Box? Like I want to display A,B and C as my dropbox strings but I have tried out many things, still my Combo Box does not display anything.
I have tried setting the 'Data' property with A;B;C..still it doesn't show this.
I tried this in my Oninitdialog() function:
CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_SENSOR_LIST);
CString string;
for(int i=0;i<10; i++)
{
string.Format("String %d", ++i);
pComboBox->AddString(string);
}
..
still no change. It may be I might not be doing something really silly but not able to figure it out at the moment. Kindly help.
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保组合框的高度可以容纳所有条目。组合框的高度不会影响组合框本身,但会影响下拉列表。
您可以在对话框编辑器中更改它:
单击组合框的向下箭头,现在应该有一个矩形,允许您更改组合框下拉列表的高度。使其足够大以容纳所有条目。
Make sure your combobox has a height that can hold all entries. The height of a combo box doesn't affect the combo box itself, but the dropdown list.
You can change it in the dialog editor:
Click on the down arrow of the combo box, now there should be a rectangle that allows you to change the height of the combobox dropdown list. Make it large enough to hold all entries.