Beispiel #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();
        }
Beispiel #2
0
 public vbox(Board parent, XmlElement node)
     : base(parent, node)
 {
 }
Beispiel #3
0
 public text(Board host, XmlElement node)
     : base(host, node)
 {
     Text = node.InnerText;
 }
Beispiel #4
0
 public img(Board host, XmlElement elm)
     : base(host, elm)
 {
     if (elm.HasAttribute("src"))
     {
         this.LoadImage(elm.GetAttribute("src"));
     }
 }
Beispiel #5
0
 public hbox(Board host, XmlElement node)
     : base(host, node)
 {
 }
Beispiel #6
0
 public flow(Board parent, XmlElement node)
     : base(parent, node)
 {
 }