MFC组合框显示数据 [英] MFC combo box showing data

查看:100
本文介绍了MFC组合框显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在SDI中创建了一个对话框,并在对话框中放置了一个组合框.
以下是组合框的初始化:

I have created a dialog in SDI and put a combo box into the dialog.
The following is the initialization of the combo box:

BOOL CprojectDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    // TODO: Add extra initialization here
    m_combobox1.AddString("Bilinear");
    m_combobox1.AddString("Near-neighbor");

    m_combobox1.SetCurSel(0);

    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}



但是,我找不到运行该程序时显示的任何项目.有什么问题吗?
谢谢!



But, I can''t find any items shown when running the program. What is the problem?
Thank you!

推荐答案

为使其正常工作,您需要在DData for DoDataExchange控件中列出m_combobox1.否则,它将不会被正确地子类化,并且AddString函数将不会对可见控件执行任何操作.

您没有为该类发布设置"的其他部分,因此这是我能想到的最好的方法,直到我们看到更多代码为止.
In order for that to work, you need to have m_combobox1 listed in the DDX Controls for DoDataExchange. Otherwise it will not be properly subclassed and the AddString function won''t do anything to the visible control.

You didn''t post the other portions of the "setup" for the class so that''s the best I can come up with until we see more of the code.


[ [ ^ ].
This[^] will help to clear your concepts regarding dialog data exchange. For more, have a look at this[^] as well.


一个大小问题,
您的组合框下拉大小可能很小,无法显示您添加的值.

要增加组合框的大小,请单击组合的Trianle按钮并增加大小..
A size problem surly,
your combo box drop down size may small that not display your added values.

to increase size of your combo box click trianle button of combo and increase size..


这篇关于MFC组合框显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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