Example #1
0
        /// <summary>
        /// 加载分割布局控件的模板
        /// </summary>
        /// <param name="splitLayoutDiv">分割布局控件</param>
        /// <param name="node">节点</param>
        public static void SplitLayoutDivTemplate(FCSplitLayoutDiv splitLayoutDiv, UIXmlEx xml, XmlNode node)
        {
            XmlDocument xmlDoc = node.OwnerDocument;

            splitLayoutDiv.Size              = new FCSize(200, 200);
            splitLayoutDiv.LayoutStyle       = FCLayoutStyle.TopToBottom;
            splitLayoutDiv.Splitter.Location = new FCPoint(0, 100);
            splitLayoutDiv.Splitter.Size     = new FCSize(200, 1);
            XmlAttribute xmlAtr1 = xmlDoc.CreateAttribute("layoutstyle");

            xmlAtr1.Value = "toptobottom";
            node.Attributes.Append(xmlAtr1);
            XmlAttribute xmlAtr2 = xmlDoc.CreateAttribute("size");

            xmlAtr2.Value = "200,200";
            node.Attributes.Append(xmlAtr2);
            XmlAttribute xmlAtr3 = xmlDoc.CreateAttribute("splitterposition");

            xmlAtr3.Value = "100,1";
            node.Attributes.Append(xmlAtr3);
            FCDiv div1 = new FCDiv();

            div1.Name = CreateControlName(div1, xml);
            div1.Size = new FCSize(200, 100);
            splitLayoutDiv.addControl(div1);
            XmlNode div1Node = xmlDoc.CreateNode(XmlNodeType.Element, "div", "");

            node.AppendChild(div1Node);
            XmlAttribute xmlAtr4 = xmlDoc.CreateAttribute("name");

            xmlAtr4.Value = div1.Name;
            div1Node.Attributes.Append(xmlAtr4);
            XmlAttribute xmlAtr5 = xmlDoc.CreateAttribute("size");

            xmlAtr5.Value = "200,100";
            div1Node.Attributes.Append(xmlAtr5);
            xml.m_controls.Add(div1);
            xml.Nodes[div1] = div1Node;
            FCDiv div2 = new FCDiv();

            div2.Name = CreateControlName(div2, xml);
            div2.Size = new FCSize(200, 100);
            splitLayoutDiv.addControl(div2);
            XmlNode div2Node = xmlDoc.CreateNode(XmlNodeType.Element, "div", "");

            node.AppendChild(div2Node);
            XmlAttribute xmlAtr6 = xmlDoc.CreateAttribute("name");

            xmlAtr6.Value = div2.Name;
            div2Node.Attributes.Append(xmlAtr6);
            XmlAttribute xmlAtr7 = xmlDoc.CreateAttribute("size");

            xmlAtr7.Value = "200,100";
            div2Node.Attributes.Append(xmlAtr7);
            xml.m_controls.Add(div2);
            xml.Nodes[div2]              = div2Node;
            splitLayoutDiv.FirstControl  = div1;
            splitLayoutDiv.SecondControl = div2;
            splitLayoutDiv.update();
        }
Example #2
0
        /// <summary>
        /// 创建分割布局控件
        /// </summary>
        /// <param name="node">节点</param>
        /// <param name="control">控件</param>
        protected virtual void createSplitLayoutSubProperty(XmlNode node, FCSplitLayoutDiv splitLayoutDiv)
        {
            int oldCount = splitLayoutDiv.getControls().size();

            setAttributesBefore(node, splitLayoutDiv);
            //读取子节点
            readChildNodes(node, splitLayoutDiv);
            ArrayList <FCView> newControls = splitLayoutDiv.getControls();

            if (newControls.size() - oldCount >= 2)
            {
                splitLayoutDiv.FirstControl  = newControls.get(newControls.size() - 2);
                splitLayoutDiv.SecondControl = newControls.get(newControls.size() - 1);
            }
            setAttributesAfter(node, splitLayoutDiv);
            splitLayoutDiv.update();
            onAddControl(splitLayoutDiv, node);
        }