public void Init(ParameterGroup parameters1, float paramNameWidth, int totalWidth) { ParameterGroup = parameters1; int nrows = ParameterGroup.Count; grid = new TableLayoutPanel(); //{ HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; grid.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, paramNameWidth)); grid.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, totalWidth - paramNameWidth)); grid.Margin = new Padding(0); for (int i = 0; i < nrows; i++){ float h = ParameterGroup[i].Visible ? ParameterGroup[i].Height : 0; grid.RowStyles.Add(new RowStyle(SizeType.Absolute, h)); } for (int i = 0; i < nrows; i++){ AddParameter(ParameterGroup[i], i); } Controls.Add(grid); Name = "ParameterPanel"; Margin = new Padding(0, 3, 0, 3); grid.Dock = DockStyle.Fill; Dock = DockStyle.Fill; }
public void Init(ParameterGroup parameters1) { Init(parameters1, 200F, 1050); }
public void TestParameterGroup() { var sparam = new ParameterGroup(new Parameter[] { new IntParam("int", 42), new StringParam("string", "42") }, "myname", false); var writer = new StringWriter(); var serializer = new XmlSerializer(sparam.GetType()); serializer.Serialize(writer, sparam); var writer2 = new StringReader(writer.ToString()); var sparam2 = (ParameterGroup)serializer.Deserialize(writer2); Assert.AreEqual(sparam.Name, sparam2.Name); Assert.AreEqual(42, ((IntParam)sparam[0]).Value); Assert.AreEqual("42", ((StringParam)sparam[1]).Value); }
private void AddParameterGroup(ParameterGroup p, int i, float paramNameWidth, int totalWidth) { ParameterGroupPanel pgp = new ParameterGroupPanel(); parameterGroupPanels[i] = pgp; pgp.Init(p, paramNameWidth, totalWidth); pgp.Dock = DockStyle.Fill; if (p.Name == null){ grid.Controls.Add(pgp, 0, i); } else{ GroupBox gb = new GroupBox{Text = p.Name, Margin = new Padding(3), Padding = new Padding(3), Dock = DockStyle.Fill,}; gb.Controls.Add(pgp); grid.Controls.Add(gb, 0, i); } }
public void TestEmptyParameterGroup() { var sparam = new ParameterGroup(new Parameter[0], "myname", false); var writer = new StringWriter(); var serializer = new XmlSerializer(sparam.GetType()); serializer.Serialize(writer, sparam); var writer2 = new StringReader(writer.ToString()); var sparam2 = (ParameterGroup)serializer.Deserialize(writer2); Assert.AreEqual(sparam.Name, sparam2.Name); }