Exemplo n.º 1
0
        internal static bool Load(TextLayout layout, System.Xml.XPath.XPathNavigator r)
        {
            switch (r.Name)
            {
            case "TextLabel":
                bool        okay;
                int         x        = 0;
                int         y        = 0;
                Color       color    = Color.Black;
                string      name     = "NoName";
                string      fontname = "Default";
                AnchorPoint anchor   = AnchorPoint.TopLeft;
                bool        everokay = false;
                bool        center   = false;
                bool        right    = false;
                TextLabel   label    = null;
                for (okay = r.MoveToFirstAttribute(); okay; okay = r.MoveToNextAttribute())
                {
                    everokay = true;
                    switch (r.Name)
                    {
                    case "AlignCenter":
                        center = Convert.ToBoolean(r.Value);
                        break;

                    case "AlignRight":
                        right = Convert.ToBoolean(r.Value);
                        break;

                    case "color":
                        color = Color.FromArgb(Convert.ToInt32(r.Value));
                        break;

                    case "font":
                        fontname = r.Value;
                        break;

                    case "Name":
                        name = r.Value;
                        break;

                    case "X":
                        x = Convert.ToInt32(r.Value);
                        break;

                    case "Y":
                        y = Convert.ToInt32(r.Value);
                        break;

                    case "Anchor":
                        switch (r.Value)
                        {
                        case "TopLeft":
                            anchor = AnchorPoint.TopLeft;
                            break;

                        case "TopRight":
                            anchor = AnchorPoint.TopRight;
                            break;

                        case "BottomLeft":
                            anchor = AnchorPoint.BottomLeft;
                            break;

                        case "BottomRight":
                            anchor = AnchorPoint.BottomRight;
                            break;
                        }
                        break;
                    }
                }
                label = new TextLabel(name, x, y, anchor, fontname, color);
                if (label != null)
                {
                    label.bDrawRightJustified = right;
                    label.bHorizCenter        = center;
                    layout.placements.Add(label);
                }
                if (everokay)
                {
                    r.MoveToParent();
                }
                break;
            }
            return(false);
        }
Exemplo n.º 2
0
 public TextLayoutInstance(Control c, TextLayout layout)
 {
     control = c;
     Layout  = layout;
     content = new List <TextLabelContent>();
 }