0

DockPanelSuite当我关闭文档时,我看到了如此奇怪的行为。当我单击'X'文档右上角的关闭时,顶部文档按预期关闭,(calls FormClosing event and Dispose() method of my derived DockContent class)但文档中仍保留一个小标签。这就像DockContent意识到应该丢弃内容并放弃所有内部控件,并且 Form.Text 从选项卡中消失了,剩下的是一个没有任何文本的小选项卡。

进一步尝试再次关闭选项卡或单击选项卡会导致'ObjectDisposedException'.

这是我的环境规格:

Visual Studio 2008
DockPanelSuite AssemblyVersion("2.5.0.*")
Windows 7 x64

下面是一个堆栈跟踪。进入代码我可以看到它在尝试获取IDragSource.DragControl我已经处理的控件的实例时爆炸了

(control being a derived DockContent class):

at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at WeifenLuo.WinFormsUI.Docking.DockPanel.DragHandlerBase.BeginDrag() in C:\Users\nick\Documents\Visual Studio 2008\Projects\DockPanel\WinFormsUI\Docking\DockPanel.DragHandler.cs:line 48
at WeifenLuo.WinFormsUI.Docking.DockPanel.DockDragHandler.BeginDrag(IDockDragSource dragSource) in C:\Users\nick\Documents\Visual Studio 2008\Projects\DockPanel\WinFormsUI\Docking\DockPanel.DockDragHandler.cs:line 699
at WeifenLuo.WinFormsUI.Docking.DockPanel.BeginDrag(IDockDragSource dragSource) in C:\Users\nick\Documents\Visual Studio 2008\Projects\DockPanel\WinFormsUI\Docking\DockPanel.DockDragHandler.cs:line 811
at WeifenLuo.WinFormsUI.Docking.DockPaneStripBase.OnMouseDown(MouseEventArgs e) in C:\Users\nick\Documents\Visual Studio 2008\Projects\DockPanel\WinFormsUI\Docking\DockPaneStripBase.cs:line 195
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at WeifenLuo.WinFormsUI.Docking.DockPaneStripBase.WndProc(Message& m) in C:\Users\nick\Documents\Visual Studio 2008\Projects\DockPanel\WinFormsUI\Docking\DockPaneStripBase.cs:line 246
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MosaicMaker.Program.Main() in C:\Users\nick\Documents\Visual Studio 2008\Projects\MosaicMaker\MosaicMaker\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

提前感谢您的帮助。

除了这个小问题,我对图书馆非常满意。

4

1 回答 1

0

好吧,我发现我的代码是问题的根源。当 DockContent 表单上的控件在其 Dispose() 方法中引发异常时,就会出现此问题。该控件未正确处理,并且由于某种原因 DockContent 控件未正确关闭。

于 2013-03-10T05:57:55.250 回答