private void LoadWindowsProperties() { DataTable dtProperties = null; if (File.Exists(Globals.settingsPath)) { XmlDocument doc = new XmlDocument(); doc.Load(Globals.settingsPath); XmlNodeList nodeList = doc.DocumentElement.GetElementsByTagName("Properties"); foreach (XmlNode node in nodeList) { dtProperties = new DataTable(); dtProperties.Columns.Add("Name"); dtProperties.Columns.Add("Description"); // new Summary control SummaryControl summaryCtrl = new SummaryControl(true); summaryCtrl.Width = pnlSummaryControls.Width; summaryCtrl.Title = node.Attributes["Type"].Value; summaryCtrl.Data = dtProperties; pnlSummaryControls.Controls.Add(summaryCtrl); XmlNodeList childNodes = node.ChildNodes; foreach (XmlNode childNode in childNodes) { dtProperties.Rows.Add(childNode.Attributes["Name"].Value, childNode.Attributes["Description"].Value); windowsProperties.Add(childNode.Attributes["Name"].Value);// this is used for validation } } } }
private void AddControls(List <Summary> summaries) { foreach (Summary summary in summaries) { SummaryControl control = new SummaryControl(summary.Collapse); control.ControlSizeChanged += new EventHandler(control_ControlSizeChanged); summaryControls.Add(control); control.Title = summary.Title; control.Data = summary.Data; control.Width = this.ClientRectangle.Width - this.Padding.Right; control.Anchor = (AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right); pnlControls.Controls.Add(control); } }
private void ArrangeControls() { for (int i = 0; i < this.summaryControls.Count; i++) { if (i == 0) { this.summaryControls[i].Location = new Point(0, 0); } else { SummaryControl previousControl = summaryControls[i - 1]; SummaryControl currentControl = summaryControls[i]; currentControl.Location = new Point(currentControl.Location.X, previousControl.Location.Y + previousControl.Height + previousControl.Padding.Bottom); } } }