سؤال

في بعض أجهزة الكمبيوتر ، يتعطل تطبيق Windows Forms في كل مرة عند فتح نماذج معينة باستخدام مكدس الاتصال:

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