Пример #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();
        }
Пример #2
0
        /// <summary>
        /// 创建层控件单元格
        /// </summary>
        public GridDivCell()
        {
            FCDiv div = new FCDiv();

            div.BorderColor   = FCColor.None;
            div.DisplayOffset = false;
            Control           = div;
        }
Пример #3
0
        /// <summary>
        /// 加载布局控件的模板
        /// </summary>
        /// <param name="layoutDiv">布局控件</param>
        /// <param name="node">节点</param>
        public static void LayoutDivTemplate(FCLayoutDiv layoutDiv, UIXmlEx xml, XmlNode node)
        {
            XmlDocument xmlDoc = node.OwnerDocument;

            layoutDiv.Size = new FCSize(200, 200);
            FCDiv div1 = new FCDiv();

            div1.Name = CreateControlName(div1, xml);
            div1.Size = new FCSize(100, 100);
            layoutDiv.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 = "100,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(100, 100);
            layoutDiv.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 = "100,100";
            div2Node.Attributes.Append(xmlAtr7);
            xml.m_controls.Add(div2);
            xml.Nodes[div2] = div2Node;
            layoutDiv.update();
        }
Пример #4
0
        /// <summary>
        /// 创建内部控件
        /// </summary>
        /// <param name="parent">父控件</param>
        /// <param name="clsid">控件标识</param>
        /// <returns>内部控件</returns>
        public override FCView createInternalControl(FCView parent, String clsid)
        {
            //日历控件
            FCCalendar calendar = parent as FCCalendar;

            if (calendar != null)
            {
                if (clsid == "datetitle")
                {
                    return(new DateTitle(calendar));
                }
                else if (clsid == "headdiv")
                {
                    HeadDiv headDiv = new HeadDiv(calendar);
                    headDiv.Width = parent.Width;
                    headDiv.Dock  = FCDockStyle.Top;
                    return(headDiv);
                }
                else if (clsid == "lastbutton")
                {
                    return(new ArrowButton(calendar));
                }
                else if (clsid == "nextbutton")
                {
                    ArrowButton nextBtn = new ArrowButton(calendar);
                    nextBtn.ToLast = false;
                    return(nextBtn);
                }
            }
            //分割层
            FCSplitLayoutDiv splitLayoutDiv = parent as FCSplitLayoutDiv;

            if (splitLayoutDiv != null)
            {
                if (clsid == "splitter")
                {
                    FCButton splitter = new FCButton();
                    splitter.BackColor   = FCColor.Border;
                    splitter.BorderColor = FCColor.Border;
                    splitter.Size        = new FCSize(5, 5);
                    return(splitter);
                }
            }
            //滚动条
            FCScrollBar scrollBar = parent as FCScrollBar;

            if (scrollBar != null)
            {
                scrollBar.BorderColor = FCColor.None;
                scrollBar.BackColor   = FCColor.None;
                if (clsid == "addbutton")
                {
                    RibbonButton addButton = new RibbonButton();
                    addButton.Size = new FCSize(10, 10);
                    if (scrollBar is FCHScrollBar)
                    {
                        addButton.ArrowType = 2;
                    }
                    else if (scrollBar is FCVScrollBar)
                    {
                        addButton.ArrowType = 4;
                    }
                    return(addButton);
                }
                else if (clsid == "backbutton")
                {
                    FCButton backButton = new FCButton();
                    backButton.BorderColor = FCColor.None;
                    backButton.BackColor   = FCColor.None;
                    return(backButton);
                }
                else if (clsid == "scrollbutton")
                {
                    RibbonButton scrollButton = new RibbonButton();
                    scrollButton.AllowDrag = true;
                    if (scrollBar is FCVScrollBar)
                    {
                        scrollButton.Angle = 0;
                    }
                    return(scrollButton);
                }
                else if (clsid == "reducebutton")
                {
                    RibbonButton reduceButton = new RibbonButton();
                    reduceButton.Size = new FCSize(10, 10);
                    if (scrollBar is FCHScrollBar)
                    {
                        reduceButton.ArrowType = 1;
                    }
                    else if (scrollBar is FCVScrollBar)
                    {
                        reduceButton.ArrowType = 3;
                    }
                    return(reduceButton);
                }
            }
            //页夹
            FCTabPage tabPage = parent as FCTabPage;

            if (tabPage != null)
            {
                if (clsid == "headerbutton")
                {
                    RibbonButton button = new RibbonButton();
                    button.AllowDrag = true;
                    FCSize size = new FCSize(100, 20);
                    button.Size = size;
                    return(button);
                }
            }
            //下拉列表
            FCComboBox comboBox = parent as FCComboBox;

            if (comboBox != null)
            {
                if (clsid == "dropdownbutton")
                {
                    RibbonButton dropDownButton = new RibbonButton();
                    dropDownButton.ArrowType     = 4;
                    dropDownButton.DisplayOffset = false;
                    int     width    = comboBox.Width;
                    int     height   = comboBox.Height;
                    FCPoint location = new FCPoint(width - 20, 0);
                    dropDownButton.Location = location;
                    FCSize size = new FCSize(20, height);
                    dropDownButton.Size = size;
                    return(dropDownButton);
                }
                else if (clsid == "dropdownmenu")
                {
                    FCComboBoxMenu comboBoxMenu = new FCComboBoxMenu();
                    comboBoxMenu.ComboBox = comboBox;
                    comboBoxMenu.Popup    = true;
                    FCSize size = new FCSize(100, 200);
                    comboBoxMenu.Size = size;
                    return(comboBoxMenu);
                }
            }
            //日期选择
            FCDateTimePicker datePicker = parent as FCDateTimePicker;

            if (datePicker != null)
            {
                if (clsid == "dropdownbutton")
                {
                    RibbonButton dropDownButton = new RibbonButton();
                    dropDownButton.ArrowType     = 4;
                    dropDownButton.DisplayOffset = false;
                    int     width    = datePicker.Width;
                    int     height   = datePicker.Height;
                    FCPoint location = new FCPoint(width - 16, 0);
                    dropDownButton.Location = location;
                    FCSize size = new FCSize(16, height);
                    dropDownButton.Size = size;
                    return(dropDownButton);
                }
                else if (clsid == "dropdownmenu")
                {
                    FCMenu dropDownMenu = new FCMenu();
                    dropDownMenu.Padding = new FCPadding(1);
                    dropDownMenu.Popup   = true;
                    FCSize size = new FCSize(200, 200);
                    dropDownMenu.Size = size;
                    return(dropDownMenu);
                }
            }
            //数字选择
            FCSpin spin = parent as FCSpin;

            if (spin != null)
            {
                if (clsid == "downbutton")
                {
                    RibbonButton downButton = new RibbonButton();
                    downButton.DisplayOffset = false;
                    downButton.ArrowType     = 4;
                    FCSize size = new FCSize(16, 16);
                    downButton.Size = size;
                    return(downButton);
                }
                else if (clsid == "upbutton")
                {
                    RibbonButton upButton = new RibbonButton();
                    upButton.DisplayOffset = false;
                    upButton.ArrowType     = 3;
                    FCSize size = new FCSize(16, 16);
                    upButton.Size = size;
                    return(upButton);
                }
            }
            //容器层
            FCDiv div = parent as FCDiv;

            if (div != null)
            {
                if (clsid == "hscrollbar")
                {
                    FCHScrollBar hScrollBar = new FCHScrollBar();
                    hScrollBar.Visible = false;
                    hScrollBar.Size    = new FCSize(10, 10);
                    return(hScrollBar);
                }
                else if (clsid == "vscrollbar")
                {
                    FCVScrollBar vScrollBar = new FCVScrollBar();
                    vScrollBar.Visible = false;
                    vScrollBar.Size    = new FCSize(10, 10);
                    return(vScrollBar);
                }
            }
            //表格
            FCGrid grid = parent as FCGrid;

            if (grid != null)
            {
                if (clsid == "edittextbox")
                {
                    return(new FCTextBox());
                }
            }
            return(base.createInternalControl(parent, clsid));
        }
Пример #5
0
        /// <summary>
        /// 表格布局控件的模板
        /// </summary>
        /// <param name="tableLayoutDiv">表格布局控件</param>
        /// <param name="xml">XML</param>
        /// <param name="node">节点</param>
        public static void TableLayoutDivTemplate(FCTableLayoutDiv tableLayoutDiv, UIXmlEx xml, XmlNode node)
        {
            XmlDocument xmlDoc = node.OwnerDocument;

            tableLayoutDiv.Size         = new FCSize(200, 200);
            tableLayoutDiv.ColumnsCount = 2;
            tableLayoutDiv.RowsCount    = 2;
            tableLayoutDiv.ColumnStyles.Add(new FCColumnStyle(FCSizeType.PercentSize, 0.5f));
            tableLayoutDiv.ColumnStyles.Add(new FCColumnStyle(FCSizeType.PercentSize, 0.5f));
            tableLayoutDiv.RowStyles.Add(new FCRowStyle(FCSizeType.PercentSize, 0.5f));
            tableLayoutDiv.RowStyles.Add(new FCRowStyle(FCSizeType.PercentSize, 0.5f));
            XmlAttribute xmlAtr1 = xmlDoc.CreateAttribute("columnscount");

            xmlAtr1.Value = "2";
            node.Attributes.Append(xmlAtr1);
            XmlAttribute xmlAtr2 = xmlDoc.CreateAttribute("rowscount");

            xmlAtr2.Value = "2";
            node.Attributes.Append(xmlAtr2);
            XmlNode columnsStylesNode = xmlDoc.CreateNode(XmlNodeType.Element, "columnstyles", "");

            node.AppendChild(columnsStylesNode);
            XmlNode columnStyleNode1 = xmlDoc.CreateNode(XmlNodeType.Element, "columnstyle", "");

            columnsStylesNode.AppendChild(columnStyleNode1);
            XmlAttribute columnStyleNodeAtr1 = xmlDoc.CreateAttribute("sizetype");

            columnStyleNodeAtr1.Value = "percentsize";
            columnStyleNode1.Attributes.Append(columnStyleNodeAtr1);
            XmlAttribute columnStyleNodeAtr2 = xmlDoc.CreateAttribute("width");

            columnStyleNodeAtr2.Value = "0.5";
            columnStyleNode1.Attributes.Append(columnStyleNodeAtr2);
            XmlNode columnStyleNode2 = xmlDoc.CreateNode(XmlNodeType.Element, "columnstyle", "");

            columnsStylesNode.AppendChild(columnStyleNode2);
            XmlAttribute columnStyleNodeAtr3 = xmlDoc.CreateAttribute("sizetype");

            columnStyleNodeAtr3.Value = "percentsize";
            columnStyleNode2.Attributes.Append(columnStyleNodeAtr3);
            XmlAttribute columnStyleNodeAtr4 = xmlDoc.CreateAttribute("width");

            columnStyleNodeAtr4.Value = "0.5";
            columnStyleNode2.Attributes.Append(columnStyleNodeAtr4);
            XmlNode rowsStylesNode = xmlDoc.CreateNode(XmlNodeType.Element, "rowstyles", "");

            node.AppendChild(rowsStylesNode);
            XmlNode rowStyleNode1 = xmlDoc.CreateNode(XmlNodeType.Element, "rowstyle", "");

            rowsStylesNode.AppendChild(rowStyleNode1);
            XmlAttribute rowStyleNodeAtr1 = xmlDoc.CreateAttribute("sizetype");

            rowStyleNodeAtr1.Value = "percentsize";
            rowStyleNode1.Attributes.Append(rowStyleNodeAtr1);
            XmlAttribute rowStyleNodeAtr2 = xmlDoc.CreateAttribute("height");

            rowStyleNodeAtr2.Value = "0.5";
            rowStyleNode1.Attributes.Append(rowStyleNodeAtr2);
            XmlNode rowStyleNode2 = xmlDoc.CreateNode(XmlNodeType.Element, "rowstyle", "");

            rowsStylesNode.AppendChild(rowStyleNode2);
            XmlAttribute rowStyleNodeAtr3 = xmlDoc.CreateAttribute("sizetype");

            rowStyleNodeAtr3.Value = "percentsize";
            rowStyleNode2.Attributes.Append(rowStyleNodeAtr3);
            XmlAttribute rowStyleNodeAtr4 = xmlDoc.CreateAttribute("height");

            rowStyleNodeAtr4.Value = "0.5";
            rowStyleNode2.Attributes.Append(rowStyleNodeAtr4);
            XmlNode childsNodes = xmlDoc.CreateNode(XmlNodeType.Element, "childs", "");

            node.AppendChild(childsNodes);

            FCDiv div1 = new FCDiv();

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

            childsNodes.AppendChild(div1Node);
            XmlAttribute divAtr1 = xmlDoc.CreateAttribute("name");

            divAtr1.Value = div1.Name;
            div1Node.Attributes.Append(divAtr1);
            xml.m_controls.Add(div1);
            xml.Nodes[div1] = div1Node;
            FCDiv div2 = new FCDiv();

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

            childsNodes.AppendChild(div2Node);
            XmlAttribute divAtr2 = xmlDoc.CreateAttribute("name");

            divAtr2.Value = div2.Name;
            div2Node.Attributes.Append(divAtr2);
            xml.m_controls.Add(div2);
            xml.Nodes[div2] = div2Node;
            FCDiv div3 = new FCDiv();

            div3.Name = CreateControlName(div3, xml);
            div3.Size = new FCSize(50, 50);
            tableLayoutDiv.addControl(div3);
            XmlNode div3Node = xmlDoc.CreateNode(XmlNodeType.Element, "div", "");

            childsNodes.AppendChild(div3Node);
            XmlAttribute divAtr3 = xmlDoc.CreateAttribute("name");

            divAtr3.Value = div3.Name;
            div3Node.Attributes.Append(divAtr3);
            xml.m_controls.Add(div3);
            xml.Nodes[div3] = div2Node;
            FCDiv div4 = new FCDiv();

            div4.Name = CreateControlName(div4, xml);
            div4.Size = new FCSize(50, 59);
            tableLayoutDiv.addControl(div4);
            XmlNode div4Node = xmlDoc.CreateNode(XmlNodeType.Element, "div", "");

            childsNodes.AppendChild(div4Node);
            XmlAttribute divAtr4 = xmlDoc.CreateAttribute("name");

            divAtr4.Value = div4.Name;
            div4Node.Attributes.Append(divAtr4);
            xml.m_controls.Add(div4);
            xml.Nodes[div4] = div4Node;
            tableLayoutDiv.update();
        }