Exemplo n.º 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();
        }
Exemplo n.º 2
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();
        }