public System.Windows.Forms.Control Clone() { SComboBox t = new SComboBox(); t.Size = this.Size; t.Location = this.Location; /*if(Parent!=null) * { * t.Left += Parent.Left; * t.Top += Parent.Top; * }*/ t.Left = this.Left; t.Top = this.Top; t.Text = this.Text; t.Font = this.Font; t.ForeColor = this.ForeColor; t.Name = this.Name; t.TabIndex = this.TabIndex; for (int i = 0; i < this.Items.Count; i++) { t.Items.Add(this.Items[i]); } return(t); }
public void ReadXml(System.Xml.XmlReader reader) { System.Xml.Serialization.IXmlSerializable cntrl; string s; s = reader.GetAttribute("Width"); if (s != null) { Width = Int32.Parse(s); } s = reader.GetAttribute("Height"); if (s != null) { Height = Int32.Parse(s); } s = reader.GetAttribute("Top"); if (s != null) { Top = Int32.Parse(s); } s = reader.GetAttribute("Left"); if (s != null) { Left = Int32.Parse(s); } s = reader.GetAttribute("TabIndex"); if (s != null) { TabIndex = Int32.Parse(s); } s = reader.GetAttribute("ControlsCount"); int c = 0; if (s != null) { c = Int32.Parse(s); } reader.ReadStartElement(); for (int i = 0; i < c; ++i) { s = reader.LocalName; if (reader.IsStartElement("ReportManager.Controls.SLabel")) { cntrl = new ReportManager.Controls.SLabel(); } else if (reader.IsStartElement("ReportManager.Controls.STextBox")) { cntrl = new ReportManager.Controls.STextBox(); } else if (reader.IsStartElement("ReportManager.Controls.SComboBox")) { cntrl = new ReportManager.Controls.SComboBox(); } else if (reader.IsStartElement("ReportManager.Controls.SMTextBox")) { cntrl = new ReportManager.Controls.SMTextBox(); } else { cntrl = null; } cntrl.ReadXml(reader); s = reader.LocalName; this.Controls.Add(cntrl as Control); } try { reader.ReadEndElement(); } catch (System.Xml.XmlException e) { s = e.StackTrace; } s = reader.LocalName; }