控件获取焦点除了用鼠标外,可以通过键盘来获取,比如Tab键或者方向键等,需要设置控件获取键盘焦点时的样式,可以通过设置FrameworkElemnt.FocusVisualStyle属性, 因为几乎所有常用的控件都继承了FrameworkElement,所以绝大部分控件都拥有该属性 // Summary: // Gets or sets a property that enables customization of appearance, effects, // or other style
很简单: 在你的CAddDlg类的OnInitDialog函数中加上你上面的代码GetDlgItem(IDC_EDIT1)->SetFocus();最后记得return FALSE; 其实,不知道返回FALSE是啥意思! 查了说明: Return Value Specifies whether the application has set the input focus to one of the controls in the dialog box. If OnInitDialog retu