I'm trying to dock several panels that I create at runtime but the exception below is thrown before the form shows.
[Exception] System.Windows.Forms.dll!System.Windows.Forms.Control.PaintWithErrorHandling(System.Windows.Forms.PaintEventArgs e, short layer) Line 9034 C#
[Exception] System.Windows.Forms.dll!System.Windows.Forms.Control.WmPaint(ref System.Windows.Forms.Message m) Line 12856 C#
[Exception] System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) Line 13245 C#
[Exception] Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.DockHost.WndProc(ref System.Windows.Forms.Message msg) Unknown
[Exception] System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(nint hWnd, Interop.User32.WM msg, nint wparam, nint lparam) Line 369 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(nint hWnd, Interop.User32.WM msg, nint wparam, nint lparam) Line 380 C#
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(nuint dwComponentID, Interop.Mso.msoloop uReason, void* pvLoopData) Line 345 C#
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Interop.Mso.msoloop reason, System.Windows.Forms.ApplicationContext context) Line 1117 C#
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Interop.Mso.msoloop reason, System.Windows.Forms.ApplicationContext context) Line 981 C#
Program.Main() Line 16 C#
Code:
m_ContentPanel = new Panel();
m_ContentPanel.Dock = DockStyle.Fill;
m_ContentPanel.Name = "ProvidersContentPanel";
m_DockingManager = new DockingManager();
m_DockingManager.ImageList = new ImageList();
m_DockingManager.ImageList.Images.Add(Properties.Resources.providers);
m_DockingManager.HostControl = Window;
m_DockingManager.HostForm = Window;
m_DockingManager.MaximizeButtonEnabled = false;
m_DockingManager.EnableContextMenu = false;
var panel = new Panel();
panel.Visible = false;
panel.Name = $"{Name}Panel";
panel.Dock = DockStyle.Fill;
m_DockingManager.SetEnableDocking(panel, true);
m_DockingManager.SetDockLabel(panel, Name);
m_DockingManager.SetDockIcon(panel, IconIndex);
m_DockingManager.SetCloseButtonVisibility(panel, false);
m_ContentPanel.Controls.Add(panel);
m_DockingManager.DockControl(panel, m_ContentPanel, DockingStyle.Fill, 500);
I see this code in all of your samples:
this.components = new System.ComponentModel.Container();
this.dockingManager1 = new Syncfusion.Windows.Forms.Tools.DockingManager(this.components);
but in my .NET application, this.components is always empty. I think this might be causing the exception.
Is this yet another compatibility issue with your platform and .NET?
Hi Aaron LeMasters,
As the panel added to the DockingManager is again added to another panel, the issue occurs. We suggest you to use the panel to any of one element to avoid this Exception.
Regards,
Bagavathi Perumal A