1.选中主对话框:Layout菜单=>Tab Order(或者直接按Ctrl+D):按你需要的TAB顺序依次单击控件.
2.按Ctrl+W打开MFC ClassWizard=>Message Maps选项卡:给你的主DLG映射PreTranslateMessage消息处理函数:
BOOL CYourDlg::PreTranslateMessage(MSG* pMsg)
{
// 顺次传递焦点,除非当前焦点在确定按钮上时才响应触发消息
if((pMsg->message == WM_KEYDOWN) && (VK_RETURN == (int) pMsg->wParam))
{
if(GetFocus()->GetDlgCtrlID() != IDOK)
{
pMsg->wParam = VK_TAB;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
时间: 2024-12-19 22:33:37