private buttonControl addButtonControl(string name = "New Button") { buttonControl buttonGroup1 = new buttonControl(); buttonGroup1.btnName = name; this.tableLayoutPanel1.Controls.Add(buttonGroup1); buttonList.Add(buttonGroup1); return(buttonGroup1); }
private void Form1_Load(object sender, System.EventArgs e) { if (System.IO.File.Exists(Application.StartupPath + @"\settings.xml")) { //FormSerialisor.Deserialise(this, Application.StartupPath + @"\settings.xml"); XDocument doc = XDocument.Load(Application.StartupPath + @"\settings.xml"); foreach (var elem in doc.Descendants("Root").Elements()) { if (elem.Name == "Group") { buttonControl btn = addButtonControl(elem.Element("btnName").Value); foreach (var output in elem.Element("outputs").Elements()) { btn.addOutput(output.Element("fileLocation").Value, output.Element("fileContents").Value); } } else if (elem.Name == "alwaysOnTop") { if (elem.Value == "true") { this.TopMost = true; checkBox1.Checked = true; } else { this.TopMost = false; checkBox1.Checked = false; } } else if (elem.Name == "size") { this.Size = new Size(Int32.Parse(elem.Element("width").Value), Int32.Parse(elem.Element("height").Value)); } } } }
private void button1_Click(object sender, EventArgs e) { buttonControl btn = addButtonControl(); btn.addOutput(); }