组合框的列表框不可见 [英] The list box of the combobox is not visible

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

问题描述

大家好!

希望对您有所帮助:)!

请考虑以下代码(我认为这足以理解我的问题,但我最终可以添加其他代码行):

Hi everybody!

I hope in your help:)!

Please, consider following code (I think it''s adequate for understanding my problem but I can eventually add other lines of code):

void CDialog::DoDataExchange(CDataExchange* pDX)
{
 CDialog::DoDataExchange(pDX);

  DDX_Control(pDX, IDC_COMBO, m_Combo);
  DDX_CBIndex(pDX, IDC_COMBO, m_ComboValue);
}

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

 m_Combo.ShowWindow(SW_SHOW);

 FromMMToDlg();

 return TRUE;
}

void CDialog::FromMMToDlg()
{
 m_Combo.AddString("aaaa");
 m_Combo.AddString("bbbb");

 OnSelchangeCombo();
}

BEGIN_MESSAGE_MAP(CDialog, CDialog)
  ON_CBN_SELCHANGE(IDC_COMBO, OnSelchangeCombo)
END_MESSAGE_MAP()

void CDialog::OnSelchangeCombo()
{
 UpdateData(TRUE);

 switch(m_ComboValue)
 {
 case 0:
  // Part A
  break;
 case 1:
  // Part B
  break;
 }
}



组合框的类型"是拖放列表",组合框的所有者画图"是否".
为什么我无法使组合框的列表框可见?

谢谢!

Sergio



The Combobox "Type" is "Drop List" and the Combobox "Owner Draw" is "No".
Why am not I able to made list box of the combobox visible?

Thanks!

Sergio

推荐答案

我要添加的一件事:确保您已确定组合框的列表框的大小.您可以在资源编辑器中执行此操作,方法是单击组合框的下拉箭头,然后将底部中心的拖动点向下拖动.
One thing I would add: make sure you have sized the listbox of the combobox. You can do this in the resource editor by clicking on the dropdown arrow of the combobox, and then dragging the bottom center dragpoint down.


确保将可见"属性设置为真" "(如果您这样做的话,则不必显式调用ShowWindow()).在相关说明中,您可能不应该从InitDialog()调用事件处理程序.除此之外,您的代码应按原样工作...我假设m_ComboCComboBox对象,对吗?

还...
-确保您的资源仍然是IDC_COMBO(在浏览属性时,我已经无意中更改了此内容)
-在资源标头文件中,确保IDC_COMBO具有唯一编号(否则,您将获得各种奇怪的行为)
-您确实为对话框命名了CDialog以外的其他名称(只是确保确定)?
Make sure the "Visible" property is set to "True" (you don''t have to explicitly call ShowWindow() if you did it that way). On a related note, you probably shouldn''t call an event handler from InitDialog(). Other than that, your code should work as is... I''m assuming m_Combo is a CComboBox object right?

Also...
-Make sure your resource is still IDC_COMBO (I''ve changed this by accident before while looking through properties)
-In your resource header file, make sure IDC_COMBO has a unique number (otherwise you''ll get all sorts of odd behavior)
-You did name your dialog something other than CDialog right (just making sure)?


这篇关于组合框的列表框不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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