質問

一部のコンピューターでは、このコールスタックで特定のフォームを開くたびに、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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top