嗨我已經設置了幾個子窗體都從一個根窗體,設置幾個按鈕和標誌等,然後過濾到孩子。 我用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