public void Init(ParameterGroup parameters1, float paramNameWidth, int totalWidth)
 {
     ParameterGroup = parameters1;
     int nrows = ParameterGroup.Count;
     tableLayoutPanel = new TableLayoutPanel();
     SuspendLayout();
     tableLayoutPanel.ColumnCount = 2;
     tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, paramNameWidth));
     tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
     tableLayoutPanel.Dock = DockStyle.Fill;
     tableLayoutPanel.Padding = new Padding(0);
     tableLayoutPanel.Margin = new Padding(0);
     tableLayoutPanel.Location = new Point(0, 0);
     tableLayoutPanel.Name = "tableLayoutPanel";
     tableLayoutPanel.RowCount = nrows;
     float totalHeight = 0;
     for (int i = 0; i < nrows; i++){
         float h = ParameterGroup[i].Visible ? ParameterGroup[i].Height : 0;
         tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, h));
         totalHeight += h;
     }
     tableLayoutPanel.Size = new Size(totalWidth, (int) totalHeight);
     tableLayoutPanel.TabIndex = 0;
     for (int i = 0; i < nrows; i++){
         AddParameter(ParameterGroup[i], i);
     }
     AutoScaleDimensions = new SizeF(6F, 13F);
     AutoScaleMode = AutoScaleMode.Font;
     Controls.Add(tableLayoutPanel);
     Name = "ParameterPanel";
     Size = new Size(totalWidth, (int) totalHeight);
     Dock = DockStyle.Fill;
     Margin = new Padding(3);
     Padding = new Padding(3);
     ResumeLayout(true);
 }
Beispiel #2
0
 public void Init(ParameterGroup parameters1)
 {
     Init(parameters1, 250F, 1000);
 }
 public object Clone()
 {
     ParameterGroup newParam = new ParameterGroup();
     foreach (Parameter p in parameters){
         newParam.parameters.Add((Parameter) p.Clone());
     }
     newParam.name = name;
     newParam.collapsedDefault = collapsedDefault;
     return newParam;
 }
 public void Init(ParameterGroup parameters1)
 {
     Init(parameters1, 250F, 1000);
 }
 private void AddParameterGroup(ParameterGroup p, int i, float paramNameWidth, int totalWidth)
 {
     ParameterGroupPanel pgp = new ParameterGroupPanel();
     parameterGroupPanels[i] = pgp;
     pgp.Init(p, paramNameWidth, totalWidth);
     if (p.Name == null){
         tableLayoutPanel.Controls.Add(pgp, 0, i);
     } else{
         Size s = new Size(pgp.Size.Width, pgp.Size.Height + 25);
         Control gb = Collapsible
             ? new CollapsibleGroupBox{
                 Dock = DockStyle.Fill, Text = p.Name, Margin = new Padding(3), Padding = new Padding(3), Size = s, FullSize = s,
                 IsCollapsed = p.CollapsedDefault
             }
             : new GroupBox{Dock = DockStyle.Fill, Text = p.Name, Margin = new Padding(3), Padding = new Padding(3)};
         gb.Controls.Add(pgp);
         tableLayoutPanel.Controls.Add(gb, 0, i);
     }
 }