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);
}