C++ MFC 高手!!!

来源:百度知道 编辑:UC知道 时间:2024/06/14 09:34:30
以下代码说明我没设dialog的回车退出,为什么在对话框的edit control 中按下回车,dialog 就退出了?究竟要怎么改才能使在edit control中输入完按下回车,dialog 不退出???
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}

。。。。这个代码说明你搞不清状况

最简单就是把对话框ok按钮的默认属性去掉

在资源编辑窗口里把你那个edit control的属性页里面的Want Return选中。就不会出这种事了,至于回车后要执行什么就得重载CEdit了。