当功能时 自动将指针移至默认按钮 在控制面板中启用,应用程序崩溃 Form.OnVisibleChanged
当形式时 AcceptButton
不来 Windows.Forms.Control
.
这显然是Windows表单中的错误 文档 没有这么说 IButtonControl AcceptButton
必须衍生 Control
.
题
在某些计算机上,我们的Windows表单应用程序每次使用此调用堆栈打开某些表单时每次崩溃:
Object reference not set to an instance of an object.
at System.Windows.Forms.Form.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at DevExpress.XtraEditors.XtraForm.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
解决方案
当功能时 自动将指针移至默认按钮 在控制面板中启用,应用程序崩溃 Form.OnVisibleChanged
当形式时 AcceptButton
不来 Windows.Forms.Control
.
这显然是Windows表单中的错误 文档 没有这么说 IButtonControl AcceptButton
必须衍生 Control
.