示例#1
0
        protected override XRect GetBounds(XRect parentBounds)
        {
            var relativeAlignment = new UnitRectangle(Left.Value, Top.Value, "0", "0");

            var left  = parentBounds.X + relativeAlignment.GetLeft(parentBounds.Width);
            var width = relativeAlignment.GetWidht(parentBounds.Width);

            var top    = parentBounds.Y + relativeAlignment.GetTop(parentBounds.Height);
            var height = relativeAlignment.GetHeight(parentBounds.Height);

            if (height < 0)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Height is adjusted from {0} to 0.", height));
                height = 0;
            }

            return(new XRect(left, top, width, height));
        }
示例#2
0
        internal static Section Load(XmlElement xmlSection)
        {
            var section = new Section();

            var name = xmlSection.Attributes["Name"];

            if (name != null)
            {
                section.Name = name.Value;
            }

            foreach (XmlElement child in xmlSection)
            {
                switch (child.Name)
                {
                case "Margin":
                    section.Margin = UnitRectangle.Load(child);
                    break;

                case "Header":
                    section.Header = Header.Load(child);
                    break;

                case "Footer":
                    section.Footer = Footer.Load(child);
                    break;

                case "Pane":
                    section.Pane = Pane.Load(child);
                    break;

                case "DefaultFont":
                    section.DefaultFont = Font.Load(child);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(string.Format("Unknown subelement {0} to section.", child.Name));
                }
            }

            return(section);
        }