public void AddChildControlsToContainer() { MyCompositeControl panel = this.XRControl as MyCompositeControl; foreach (XRControl childControl in panel.Controls) { System.Drawing.PointF loc = childControl.LocationF; IDesignerHost designerHost = (IDesignerHost)GetService(typeof(IDesignerHost)); DesignToolHelper.AddToContainer(designerHost, childControl); childControl.LocationF = loc; } }
public void InitControls() { MyCompositeControl panel = this.XRControl as MyCompositeControl; XRLabel label1 = new XRLabel(); label1.ExpressionBindings.Add(new ExpressionBinding("Text", "[ProductID]")); label1.SizeF = new System.Drawing.SizeF(200, 25); panel.Controls.Add(label1); XRLabel label2 = new XRLabel(); panel.Controls.Add(label2); label2.SizeF = new System.Drawing.SizeF(200, 25); label2.LocationF = new System.Drawing.PointF(0, 25); label2.ExpressionBindings.Add(new ExpressionBinding("Text", "[ProductName]")); }