未处理 System.OutOfMemoryException
  Message="创建窗口句柄时出错。"
  Source="System.Windows.Forms"
  StackTrace:
       在 System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
       在 System.Windows.Forms.Control.CreateHandle()
       在 System.Windows.Forms.Form.CreateHandle()
       在 System.Windows.Forms.Control.get_Handle()
       在 System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       在 System.Windows.Forms.Control.Show()
       在 ShengTeng.HIS.View.NSDoctorsAdvice.DoctorsAdviceForm.HomePToolStripButton_Click(Object sender, EventArgs e)行号 740
       在 System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       在 System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
       在 System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       在 System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       在 System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       在 System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       在 System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       在 System.Windows.Forms.Control.WndProc(Message& m)
       在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       在 System.Windows.Forms.ToolStrip.WndProc(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.Run(Form mainForm)
       在 ShengTeng.HIS.STHIS.Program.Main() 位置Program.cs:行号 42
       在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.NullReferenceException
       Message="未将对象引用设置到对象的实例。"
       Source="System.Windows.Forms"
       StackTrace:
            在 System.Windows.Forms.NativeWindow.WindowClass.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
            在 System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
            在 System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
            在 System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
       InnerException: 

解决方案 »

  1.   

    使用了第三方控件吧?先在设计时看看能不能正常加载控件,如果不能加载的话重新引用一下自定义控件DLL,重新编译后再看看。像你这种情况有可能是项目移动时自定义控件的引用路径发生变化,导致设计时可能弄丢了控件从而出错。
      

  2.   

      if (this._CaseHistoryHomePage == null || this._CaseHistoryHomePage.IsDisposed)
                        {
                            
                           this._CaseHistoryHomePage = new CaseHistoryHomePage();
                            this._CaseHistoryHomePage.MdiParent = this.MdiParent;
                            this._CaseHistoryHomePage.strZid = regsiterID;                    }
                        this._CaseHistoryHomePage.Show();
                        this._CaseHistoryHomePage.Activate();