DDX_Control

1.将变量m_Edit和控件IDC_EDIT进行绑定

2.通过修改变量的数值控制控件操作。

学习关于下拉菜单的制作:CComboBox类型数据:  m_select

void CDlgOPTFactorMonitor::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COMBO_MAINFACTOR, m_select);
}

3.以下拉菜单为例

BOOLOnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化;
	m_select.ResetContent(); 
	
	//组合框中显示设计变量、目标函数和约束的名称;
		string sName = 'a';
		m_select.AddString(sName.c_str());
		}
	}

	//设置默认的选项卡;
	m_select.SetCurSel(0);
	iPos=0;

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}

void OnCbnSelchangeComboMainfactor()
{
	// TODO: 在此添加控件通知处理程序代码
	// 获取选项卡;
	iPos=m_select.GetCurSel();
       //添加要实现的功能函数;
	
}






你可能感兴趣的:(计算机基础知识1(面向问题))