代码如下:
PanelOperate.Instance.addPanelFun(MainPanelControl, tableLayoutPanel2);
            PanelOperate.Instance.addPanelFun(subMainPanel, dividePlayUC1);            tableLayoutPanel2.Controls.Add(dividePlayUC2, 2, 0);
            tableLayoutPanel2.Controls.Add(dividePlayUC3, 2, 1);
            tableLayoutPanel2.Controls.Add(dividePlayUC4, 0, 2);
            tableLayoutPanel2.Controls.Add(dividePlayUC5, 1, 2);
            tableLayoutPanel2.Controls.Add(dividePlayUC6, 2, 2);其实就是往 tableLayoutPanel2中添加一个自定义控件,在dividePlayUC2~6中随便删掉一个就没有异常了
异常提示如下:
未处理 System.NullReferenceException
  Message="未将对象引用设置到对象的实例。"
  Source="DotNetSkin"
  StackTrace:
       在 DotNetSkin.xa57f10721950fcb7.x7de569eaa7dc8ed4()
       在 DotNetSkin.xa57f10721950fcb7.xb8a58759934130a1(IntPtr x7cc24662a4086c94, Int32 x1f25abf5fb75e795, IntPtr xa6f52d0dc8f93cc2, IntPtr x3e0c21d3ecb2305d)
       在 System.Windows.Forms.SafeNativeMethods.SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, Int32 x, Int32 y, Int32 cx, Int32 cy, Int32 flags)
       在 System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
       在 System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
       在 System.Windows.Forms.Layout.TableLayout.SetElementBounds(ContainerInfo containerInfo, RectangleF displayRectF)
       在 System.Windows.Forms.Layout.TableLayout.LayoutCore(IArrangedElement container, LayoutEventArgs args)
       在 System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
       在 System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
       在 System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
       在 System.Windows.Forms.TableLayoutPanel.OnLayout(LayoutEventArgs levent)
       在 System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
       在 System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
       在 System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
       在 System.Windows.Forms.Control.ControlCollection.Add(Control value)
       在 System.Windows.Forms.Control.set_ParentInternal(Control value)
       在 System.Windows.Forms.Control.set_Parent(Control value)
       在 DotNetSkin.x42259d7b6d258ef8.xc0fc2d0cd0379c1f(Object xb05c06fd57cfef8e, Control xa59bff7708de3a18, Int32 x8b9d5e515dca800e)
       在 DotNetSkin.xa57f10721950fcb7.x0ff65b643a849ff5(Control xa59bff7708de3a18)
       在 DotNetSkin.xf9a610bd8102978b..ctor(Control obj)
       在 DotNetSkin.xa57f10721950fcb7..ctor(Control obj)
       在 DotNetSkin.xbf4240343b629a46.x0ff65b643a849ff5(Control x2d359efb5bac57e8)
       在 DotNetSkin.xbf4240343b629a46.x0932900269baf25f(Object xe0292b9ed559da7d, ControlEventArgs xfbf34718e704c6bc)
       在 System.Windows.Forms.Control.OnControlAdded(ControlEventArgs e)
       在 System.Windows.Forms.Control.ControlCollection.Add(Control value)
       在 System.Windows.Forms.TableLayoutControlCollection.Add(Control control, Int32 column, Int32 row)
       在 LiveVideoTest.dividePanel.SixPanels() 位置 E:\正式程序\LiveVideoTest\LiveVideoTest\dividePanel.cs:行号 77
       在 LiveVideoTest.MainForm.button6_Click(Object sender, EventArgs e) 位置 E:\正式程序\LiveVideoTest\LiveVideoTest\MainForm.cs:行号 253
       在 System.Windows.Forms.Control.OnClick(EventArgs e)
       在 System.Windows.Forms.Button.OnClick(EventArgs e)
       在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       在 System.Windows.Forms.Control.WndProc(Message& m)
       在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
       在 System.Windows.Forms.Button.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)
       在 DotNetSkin.x443cc432acaadb1d.CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       在 DotNetSkin.xf9a610bd8102978b.xb8a58759934130a1(IntPtr x7cc24662a4086c94, Int32 x1f25abf5fb75e795, IntPtr xa6f52d0dc8f93cc2, IntPtr x3e0c21d3ecb2305d)
       在 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)
       在 LiveVideoTest.Program.Main() 位置 E:\正式程序\LiveVideoTest\LiveVideoTest\Program.cs:行号 17
       在 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()
那位大大遇到过这种问题?