我有一个小的Windows应用程序,其中我显示一个对话框。在该对话框中,我有2个按钮“确定”和“取消”。
我想在该对话框上设置“确定”按钮,因此当按下Enter键时,我们可以直接进行处理。
IDD_DOMAINVALIDATOR DIALOGEX 0, 0, 247, 180
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOPMOST
FONT 8, "Ms Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "Domain",IDC_STATIC,10,84,44,9
COMBOBOX IDNAME,96,79,120,12,CBS_DROPDOWN | CBS_HASSTRINGS
LTEXT "Please enter your domain credentials",IDC_STATIC,10,61,230,9
PUSHBUTTON "Cancel",IDCANCEL,96,130,56,14
PUSHBUTTON "OK",IDMOK,159,130,56,14
LTEXT "Domain username",IDC_STATIC,10,99,58,9
EDITTEXT IDUSER,96,95,120,13,ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_CLIENTEDGE
LTEXT "Domain password",IDC_STATIC,10,114,57,9
EDITTEXT IDPASS,96,112,120,13,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_CLIENTEDGE
Reserved",IDC_STATIC,10,171,228,9
CONTROL IDB_BANNER,IDC_STATIC,"Static",SS_BITMAP,0,0,248,52
END
答案 0 :(得分:1)
您只需将其中一个按钮设置为BS_DEFPUSHBUTTON
样式即可。