嗨我已经设置了几个子窗体都从一个根窗体,设置几个按钮和标志等,然后过滤到孩子。 我用Visual Studio的向导添加子窗体从根继承和它们与自动声明:C#根窗体继承,更改导致破碎的子窗体
public partial class WelcomeForm : MynetInstaller.rootForm
现在我已经被要求调整子窗体和移动按钮,事情我希望会做通过简单地更改根形式并允许更改过滤。
我的两个问题是: 1 /我改变了大小,这根本不影响孩子,似乎在初始设置后大小没有被继承。
2 /我改变按钮的位置,这将导致所有子窗体突破表明一个错误:
To prevent possible data loss before loading the designer, the following errors must be resolved:
'child' is not a child control of this parent.
Instances of this error (1)
1. Hide Call Stack
at System.Windows.Forms.Control.ControlCollection.GetChildIndex(Control child, Boolean throwException)
at System.Windows.Forms.Control.ControlCollection.SetChildIndexInternal(Control child, Int32 newIndex)
at System.Windows.Forms.Control.ControlCollection.SetChildIndex(Control child, Int32 newIndex)
at System.Windows.Forms.Design.ControlDesigner.DesignerControlCollection.SetChildIndex(Control child, Int32 newIndex)
如果我按下去会加载页面,但不会有移动的按钮,如果我尝试并运行它我得到一个错误:
this.Controls.SetChildIndex(this.btnNext, 0);
说:
'child' is not a child control
我诺蒂奇编辑,当我移动控制它停止成为锁定,但手动改变这并没有帮助。
在我继承的表单控件位置发生变化时。我解决了这个问题。我从.designer.cs文件中移除“this.AutoScaleDimensions = new System.Drawing.SizeF(6F,13F);”线。 – 2015-06-18 07:46:10