最新在做一套 GIS 系統的框架,其中用到了 Janus WinForms Controls 和 Developer Express 這兩個外掛。
我用 DE 的 xtraTabbedMdiManager 元件來管理我的子視窗。在父視窗中放置了 Janus 的 Ribbon 控制項做選單。讓我比較憂鬱的是,直接放上去會在執行的時候會彈出錯誤視窗,如下:
System.InvalidOperationException: 視窗控制代碼已存在。
在 System.Windows.Forms.NativeWindow.CheckReleased()
在 System.Windows.Forms.NativeWindow.AssignHandle(IntPtr handle, Boolean assignUniqueID)
在 System.Windows.Forms.NativeWindow.AssignHandle(IntPtr handle)
在 Janus.Windows.Ribbon.JNSI.a(Object A_1, EventArgs A_2)
在 System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
在 System.Windows.Forms.Control.OnParentVisibleChanged(EventArgs e)
在 System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
在 System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e)
在 System.Windows.Forms.Form.OnVisibleChanged(EventArgs e)
在 System.Windows.Forms.Control.WmShowWindow(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
在 System.Windows.Forms.Form.WmShowWindow(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在網上查了很久,也沒有查到相關的資料。今天晚上想起之前解決 arcengine 裡 toc 和 DE 的衝突問題的方法。借鑑這個方法,成功解決了這個問題。具體辦法如下:
在設計時把 xtraTabbedMdiManager 的 MDIParent 設定為無,在父視窗初始化時,加入:xtraTabbedMdiManager1.MdiParent = this; 搞定!
希望遇到類似問題的朋友可以借鑑一下!高興 ing!