Пример #1
0
        public Element(Board Host, XmlElement node)
        {
            this.Board = Host;
            this.node = node;
            this.BackColor = ParseColorAttribute("BackColor", ("bgcolor"), node);

            this.ForeColor = ParseColorAttribute("ForeColor", "color", node);

            if (node.HasAttribute("margin"))
            {
                this.Margin = new Margin(node.GetAttribute("margin"));
            }
            if (node.HasAttribute("flex"))
            {
                this.Flex = int.Parse(node.GetAttribute("flex"));
            }
            if (node.HasAttribute("padding"))
            {
                this.Padding = new Padding(node.GetAttribute("padding"));
            }
            if (node.HasAttribute("uri"))
            {
                this.Hyperlink = node.GetAttribute("uri");
            }
            if (node.HasAttribute("name"))
            {
                this.Name = node.GetAttribute("name");
            }
            if (node.HasAttribute("width"))
            {
                if (node.GetAttribute("width") == "100%")
                {
                    Dock |= DockStyle.Right;
                    //Width = Parent.Width - Margin * 2 + Parent.Padding * 2;
                }
                else
                {
                    this.Width = int.Parse(node.GetAttribute("width"));
                }
            }
            else
            {
                this.Width = Parent != null ? Parent.Width : Board.Width;
            }
            if (node.HasAttribute("height"))
            {
                this.Height = int.Parse(node.GetAttribute("height"));
            }
            else
            {
                this.Height = 32;
            }
            foreach (XmlNode elm in node.ChildNodes)
            {
                if (elm.GetType() == typeof(XmlElement))
                {
                    try
                    {
                        Element _elm = (Element)Type.GetType("LerosClient." + elm.Name).GetConstructor(new Type[] { typeof(Board), typeof(XmlElement) }).Invoke( new Object[] {this.Board, elm});
                        this.Children.Add(_elm);
                        _elm.Parent=this;
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            PackChildren();
        }
Пример #2
0
 public vbox(Board parent, XmlElement node)
     : base(parent, node)
 {
 }
Пример #3
0
 public text(Board host, XmlElement node)
     : base(host, node)
 {
     Text = node.InnerText;
 }
Пример #4
0
 public img(Board host, XmlElement elm)
     : base(host, elm)
 {
     if (elm.HasAttribute("src"))
     {
         this.LoadImage(elm.GetAttribute("src"));
     }
 }
Пример #5
0
 public hbox(Board host, XmlElement node)
     : base(host, node)
 {
 }
Пример #6
0
 public flow(Board parent, XmlElement node)
     : base(parent, node)
 {
 }