2012-02-28 61 views
0

我將用戶控件動態添加到標籤面板中如何將它添加到與標籤面板相關的中心位置 ?將用戶控件動態添加到中心的標籤面板

+0

答案:取決於使用的UI框架。 Winforms與Silverlight完全不同,它們與Mono有很大不同(我認爲我還沒有使用過Mono)。 – Nuffin 2012-02-28 06:44:13

+0

我正在使用Winforms – 2012-02-28 06:50:39

回答

2

位置控件的屬性應該允許您動態地定位控件。

 this.userControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
        | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right))); 
     this.userControl.Location = new System.Drawing.Point(108, 85);