Hello,
I have to create dynamically several UltraExpandableGroupBox. All of them are inserted into a .NET FlowLayoutPanel just after been created.My FlowLayoutPanel is docked in my form and I want my UltraExpandableGroupBox resize automatically (specially the Horizontal size) into the FlowLayoutPanel when the user change the form size. Unfortunatly, my UltraExpandableGroupBox never resize even when the FlowLayoutPanel resize itself.Here is a sample of my code. Thanks if anyone can help me to find out what to do.
UltraExpandableGroupBox uegb = new UltraExpandableGroupBox(); UltraExpandableGroupBoxPanel panel = new UltraExpandableGroupBoxPanel(); MyUsercontrol uc = new MyUsercontrol();
((ISupportInitialize)uegb).BeginInit(); uegb.SuspendLayout(); panel.SuspendLayout();
uc.Presenter = _presenter; uc.Dock = DockStyle.Top; uc.BuildAndBindFields(container, regroupement); // build MyUserconrol content.
// box
uegb.Controls.Add(panel); uegb.Dock = DockStyle.Top; uegb.MinimumSize = new System.Drawing.Size(685, 24); uegb.ExpandedSize = new System.Drawing.Size(685, 500); uegb.ExpansionIndicator = Infragistics.Win.Misc.GroupBoxExpansionIndicator.Far; uegb.Location = new System.Drawing.Point(3, 3); uegb.Text = container.GetTraduction(regroupement); uegb.ViewStyle = Infragistics.Win.Misc.GroupBoxViewStyle.Office2003; uegb.Expanded = false;
// panel
panel.Controls.Add(uc); panel.AutoScroll = true; panel.Dock = System.Windows.Forms.DockStyle.Fill; panel.Location = new System.Drawing.Point(2, 22); panel.Size = new System.Drawing.Size(681, 426);
((ISupportInitialize)(uegb)).EndInit(); panel.ResumeLayout(false); uegb.ResumeLayout(false);
Is this a bug? I am unable to get my controls to resize inside a flow layout panel as well.
I was able to get the UltraGroupBox to "AutoSize", but it was a hack.
private void BuildMyControl(){ UltraGroupBox ugb = new UltraGroupBox(); ugb.Dock = DockStyle.Top; this.Controls.Add(ugb); ugb.Text = "My Control"; Panel pnl = new Panel(); pnl.AutoSize = true; pnl.Dock = DockStyle.Top; pnl.Top = 21; // Make room for the header ugb.Controls.Add(pnl); //... // Add whatever controls you want to the Panel, not the GroupBox //... ugb.Height = pnl.Top + pnl.Height;}
It got the job done for me... I would like to know of a fix for this, though...