日期:2014-05-17  浏览次数:22292 次

C# splitContainer.SplitterDistance的问题
System.InvalidOperationException: SplitterDistance 必须在 Panel1MinSize 和 Width - Panel2MinSize 之间。在主窗体上添加上splitContainer1控件,所有子窗体全显示在splitContainer1.Panel2中,只有一个子窗体A显示时会提示这个错误,其他窗体没有提示
,百思不得其解;
下面是 designer.cs文件中的定义


// 
            // splitContainer1
            // 
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
            this.splitContainer1.Location = new System.Drawing.Point(0, 85);
            this.splitContainer1.Name = "splitContainer1";
            // 
            // splitContainer1.Panel1
            // 
            this.splitContainer1.Panel1.Controls.Add(this.panel1);
            this.splitContainer1.Panel1.Controls.Add(this.panel2);
            this.splitContainer1.Panel1MinSize = 1;
            // 
            // splitContainer1.Panel2
            // 
            this.splitContainer1.Panel2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("splitContainer1.Panel2.BackgroundImage")));
            this.splitContainer1.Panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.splitContainer1.Size = new System.Drawing.Size(906, 431);
            this.splitContainer1.SplitterDistance = 132;
            this.splitContainer1.TabIndex = 11;

------解决方案--------------------
试试重新加载控件
------解决方案--------------------
wo 试试重新加载控件