internal void SetData(Dictionary<string, int> v, string[] keys, int d) { Parameter[] p = new Parameter[keys.Length]; for (int i = 0; i < p.Length; i++){ p[i] = new IntParam(keys[i], v.ContainsKey(keys[i]) ? v[keys[i]] : d); } parameterPanel1.Init(new Parameters(p)); }
private void AddParameter(Parameter p, int i) { if (!string.IsNullOrEmpty(p.Help)){ Panel pa = new Panel{Dock = DockStyle.Fill, Width = 245, Margin = new Padding(0), Padding = new Padding(0)}; pa.Controls.Add(CreateLabel(p.Name, p.Help)); tableLayoutPanel.Controls.Add(pa, 0, i); } else{ Panel pa = new Panel{Dock = DockStyle.Fill}; Label l = new Label {Width = 245, Text = p.Name, Location = new Point(2, 3), Anchor = AnchorStyles.Top | AnchorStyles.Left}; pa.Controls.Add(l); tableLayoutPanel.Controls.Add(pa, 0, i); } Control c = p.GetControl(); c.Width = 500; c.Dock = DockStyle.Fill; tableLayoutPanel.Controls.Add(c, 1, i); }
public Parameters(Parameter param) : this(new[]{param}) { }