Skip to content

Replies

0
Greg Meisner
Greg Meisner answered on Jul 24, 2019 8:57 PM

Mike,

I just looked at the form… All fields are defaulting to Top, Left.

Here is the code that’s failing:

 

0
Greg Meisner
Greg Meisner answered on Jul 24, 2019 3:15 PM

Mike,

After taking your test application and modifying it so that it starts to replicate what we are doing, I think I've discovered the source of the problem and why the controls are not visible.

If I add a control to the Group Box with a Location beyond the ExpandedSize of the control, even if I grow the Expanded Size of the Group Box AFTER I add my control, the control is not visible. If I increment the ExpandedSize of the Group Box BEFORE I add my control, everything works as expected.

Let me clean up the test code and I'll post it here for your reference.

0
Greg Meisner
Greg Meisner answered on Jul 23, 2019 8:54 PM

Mike,

That doesn’t work for me at all….

As a test, I simplified my code down to the bare essentials… In my app, I have a Panel that will hold the Ultra Expandable Group Box. At runtime, I create the Group Box just like you do, and add it to my panel with:

this.panel4.Controls.Add(expandableGroupBox);

I followed your code and added a button to the Group Box.

Here’s what I see:  

As a test, I added an Expandable Group Box to my form via the Visual Studio Designer. At run time, I placed the same button I used from your example into that control.

So a Design Time control is able to accept controls added at run-time, but an Ultra Expandable Group box added at run-time never displays any controls. This is very confusing!

0
Greg Meisner
Greg Meisner answered on Jul 23, 2019 7:54 PM

Michael,

I’m basically following the code located at https://www.infragistics.com/help/winforms/infragistics.win.misc~infragistics.win.misc.ultraexpandablegroupbox

to understand how to add controls. One big difference from the example of yours and Mine is – I’ve created the Ultra Expandable Group Box at run-time.

My code looks like:

UltraExpandableGroupBox grpBox_1 = new UltraExpandableGroupBox(); UltraExpandableGroupBoxPanel ultraExpandableGroupBoxPanel_1 = new UltraExpandableGroupBoxPanel();// // grpBox_1 // grpBox_1.Controls.Add(ultraExpandableGroupBoxPanel_1); grpBox_1.Dock = System.Windows.Forms.DockStyle.Top; grpBox_1.ExpandedSize = new System.Drawing.Size(1125, 50); grpBox_1.Location = new System.Drawing.Point(0, iGroupYLocation); grpBox_1.Margin = new System.Windows.Forms.Padding(10); grpBox_1.Name = strNewGroupName; grpBox_1.Size = new System.Drawing.Size(1125, 50); grpBox_1.TabIndex = 0; grpBox_1.Text = strNewGroupName; grpBox_1.Visible = true; grpBox_1.Expanded = false; // // ultraExpandableGroupBoxPanel1 // ultraExpandableGroupBoxPanel_1.Dock = System.Windows.Forms.DockStyle.Fill; ultraExpandableGroupBoxPanel_1.Location = new System.Drawing.Point(3, 20); ultraExpandableGroupBoxPanel_1.Name = strNewGroupName + “_ExpandableGroupBoxPanel1”; ultraExpandableGroupBoxPanel_1.Size = new System.Drawing.Size(1119, 27); ultraExpandableGroupBoxPanel_1.TabIndex = 0; ultraExpandableGroupBoxPanel_1.Visible = true;

and I add a simple text box to the Group Box with:

// Build a TextBox TextBox txtBox = new TextBox { Name = “TestTextBox” }; txtBox.Font = new System.Drawing.Font(“Segoe UI”, 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); txtBox.Location = new System.Drawing.Point(20, iChildControlYPosition); txtBox.Name = “gp” + iGroupIndex + “_txtbox” + iChildIndex; txtBox.Size = new System.Drawing.Size(68, 22); txtBox.TabIndex = 1; txtBox.Text = “Testing text”; txtBox.Visible = true;

grpBox_1.Panel.Controls.Add(txtBox);

Here is a pic of the output:

Notice the empty panel? No Text Boxes are displayed!

Any ideas?

0
Greg Meisner
Greg Meisner answered on Jul 23, 2019 7:32 PM

Michael,

The Ultra Expandable Group Box itself is being created at run-time.  My code looks like this: (Note, this is the code Visual Studio created in its designer…)

UltraExpandableGroupBox grpBox_1 = new UltraExpandableGroupBox(); UltraExpandableGroupBoxPanel ultraExpandableGroupBoxPanel_1 = new UltraExpandableGroupBoxPanel();

// // grpBox_1 // grpBox_1.Controls.Add(ultraExpandableGroupBoxPanel_1); grpBox_1.Dock = System.Windows.Forms.DockStyle.Top; grpBox_1.ExpandedSize = new System.Drawing.Size(1125, 50); grpBox_1.Location = new System.Drawing.Point(0, iGroupYLocation); grpBox_1.Margin = new System.Windows.Forms.Padding(10); grpBox_1.Name = strNewGroupName; grpBox_1.Size = new System.Drawing.Size(1125, 50); grpBox_1.TabIndex = 0; grpBox_1.Text = strNewGroupName; grpBox_1.Visible = true; grpBox_1.Expanded = false; // // ultraExpandableGroupBoxPanel1 // ultraExpandableGroupBoxPanel_1.Dock = System.Windows.Forms.DockStyle.Fill; ultraExpandableGroupBoxPanel_1.Location = new System.Drawing.Point(3, 20); ultraExpandableGroupBoxPanel_1.Name = strNewGroupName + “_ExpandableGroupBoxPanel1”; ultraExpandableGroupBoxPanel_1.Size = new System.Drawing.Size(1119, 27); ultraExpandableGroupBoxPanel_1.TabIndex = 0; ultraExpandableGroupBoxPanel_1.Visible = true;

When it’s time to add my control, I’m simply:

grpBox_1.Panel.Controls.Add(gp1_lblLastEditedDate1);

As you can see, the Group Boxes are empty…

Any ideas?