void PanelOnPaint(object obj, PaintEventArgs pea) { Graphics grfx = pea.Graphics; Brush brush = new SolidBrush(ForeColor); int iCount = SysInfoStrings.Count; string[] astrLabels = SysInfoStrings.Labels; string[] astrValues = SysInfoStrings.Values; for (int i = 0; i < iCount; i++) { grfx.DrawString(astrLabels[i], Font, brush, 0, cySpace * i); grfx.DrawString(astrValues[i], Font, brush, cxCol, cySpace * i); } // test Выводим данные свойств класса ScrollableControl, наследуемого экземпляром panel grfx.DrawString(HScroll.ToString(), Font, brush, 400, 100); grfx.DrawString(VScroll.ToString(), Font, brush, 426, 100); grfx.DrawString(AutoScrollPosition.ToString(), Font, brush, 400, 100 + cySpace); }
public XmlNode GenerateXML() { // Create XML Node and Attributes XmlDocument d = new XmlDocument(); XmlNode output = d.CreateNode("element", "InputText", null); XmlAttribute adValidate = d.CreateAttribute("ADValidate"); XmlAttribute _default = d.CreateAttribute("Default"); XmlAttribute forceCase = d.CreateAttribute("ForceCase"); XmlAttribute hint = d.CreateAttribute("Hint"); XmlAttribute hScroll = d.CreateAttribute("HScroll"); XmlAttribute password = d.CreateAttribute("Password"); XmlAttribute prompt = d.CreateAttribute("Prompt"); XmlAttribute question = d.CreateAttribute("Question"); XmlAttribute regEx = d.CreateAttribute("RegEx"); XmlAttribute required = d.CreateAttribute("Required"); XmlAttribute variable = d.CreateAttribute("Variable"); XmlAttribute condition = d.CreateAttribute("Condition"); // Set Attribute Values adValidate.Value = ADValidate; _default.Value = Default; forceCase.Value = ForceCase; hint.Value = Hint; hScroll.Value = HScroll.ToString(); password.Value = Password.ToString(); prompt.Value = Prompt; question.Value = Question; regEx.Value = RegEx; required.Value = Required.ToString(); variable.Value = Variable; condition.Value = Condition; // Append Attributes if (!string.IsNullOrEmpty(ADValidate)) { output.Attributes.Append(adValidate); } if (!string.IsNullOrEmpty(Default)) { output.Attributes.Append(_default); } if (!string.IsNullOrEmpty(ForceCase)) { output.Attributes.Append(forceCase); } if (!string.IsNullOrEmpty(Hint)) { output.Attributes.Append(hint); } if (null != HScroll) { output.Attributes.Append(hScroll); } if (null != Password) { output.Attributes.Append(password); } if (!string.IsNullOrEmpty(Prompt)) { output.Attributes.Append(prompt); } if (!string.IsNullOrEmpty(Question)) { output.Attributes.Append(question); } if (!string.IsNullOrEmpty(RegEx)) { output.Attributes.Append(regEx); } if (null != Required) { output.Attributes.Append(required); } if (!string.IsNullOrEmpty(Variable)) { output.Attributes.Append(variable); } if (!string.IsNullOrEmpty(Condition)) { output.Attributes.Append(condition); } return output; }