栈跟踪:
at NmSpcMagicCube.FormMagic.grpMyCubeView_SizeChanged(Object
sender, EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y,
Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y,
Int32 width, Int32 height)
at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y,
Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Control.ScaleControl(SizeF factor,
BoundsSpecified specified)
at System.Windows.Forms.GroupBox.ScaleControl(SizeF factor,
BoundsSpecified specified)
at System.Windows.Forms.Control.ScaleControl(SizeF includedFactor,
SizeF excludedFactor, Control requestingControl)
at System.Windows.Forms.Control.Scale(SizeF includedFactor, SizeF
excludedFactor, Control requestingControl)
at System.Windows.Forms.Control.ScaleChildControls(SizeF
includedFactor, SizeF excludedFactor, Control requestingControl)
at System.Windows.Forms.ContainerControl.Scale(SizeF
includedFactor, SizeF excludedFactor, Control requestingControl)
at System.Windows.Forms.ContainerControl.PerformAutoScale(Boolean
includedBounds, Boolean excludedBounds)
at
System.Windows.Forms.ContainerControl.PerformNeededAutoScaleOnLayout()
at System.Windows.Forms.ContainerControl.OnLayoutResuming(Boolean
performLayout)
at System.Windows.Forms.Control.ResumeLayout(Boolean performLayout)
at NmSpcMagicCube.FormMagic.InitializeComponent()
at NmSpcMagicCube.FormMagic..ctor()
at NmSpcMagicCube.Program.Main()
猜测是FormMagic在pCubeView初始化完成之前被调用了SizeChanged(),导致了空引用。