示例#1
0
        /// <summary>
        /// 多页夹控件的模板
        /// </summary>
        /// <param name="tabControl">多页夹控件</param>
        /// <param name="node">节点</param>
        public static void TabControlTemplate(FCTabControl tabControl, UIXmlEx xml, XmlNode node)
        {
            XmlDocument xmlDoc = node.OwnerDocument;

            tabControl.Size = new FCSize(200, 200);
            FCTabPage tabPage = new FCTabPage();

            tabControl.addControl(tabPage);
            tabPage.Name = CreateControlName(tabPage, xml);
            tabPage.Text = tabPage.Name;
            XmlNode tabPageNode = xmlDoc.CreateNode(XmlNodeType.Element, "div", "");

            node.AppendChild(tabPageNode);
            XmlAttribute xmlAtr1 = xmlDoc.CreateAttribute("name");

            xmlAtr1.Value = tabPage.Name;
            tabPageNode.Attributes.Append(xmlAtr1);
            XmlAttribute xmlAtr2 = xmlDoc.CreateAttribute("text");

            xmlAtr2.Value = tabPage.Name;
            tabPageNode.Attributes.Append(xmlAtr2);
            XmlAttribute xmlAtr3 = xmlDoc.CreateAttribute("type");

            xmlAtr3.Value = "tabpage";
            tabPageNode.Attributes.Append(xmlAtr3);
            xml.m_controls.Add(tabPage);
            xml.Nodes[tabPage] = tabPageNode;
            tabControl.update();
        }
示例#2
0
        /// <summary>
        /// 删除类
        /// </summary>
        public void deleteClass()
        {
            List <FCGridRow> selectedRows = m_tvCollection.SelectedRows;
            int selectedRowsSize          = selectedRows.Count;

            if (selectedRowsSize > 0)
            {
                if (m_collectionName == "TabPages")
                {
                    FCTabControl tabControl = m_target as FCTabControl;
                    FCTabPage    tabPage    = selectedRows[0].Tag as FCTabPage;
                    m_xml.removeControl(tabPage);
                    m_tvCollection.removeRow(selectedRows[0]);
                    m_tvCollection.update();
                    tabControl.update();
                }
                else if (m_collectionName == "Columns")
                {
                    FCGrid       grid   = m_target as FCGrid;
                    FCGridColumn column = selectedRows[0].Tag as FCGridColumn;
                    grid.removeColumn(column);
                    m_xml.m_controls.Remove(column);
                    m_xml.Nodes[column].ParentNode.RemoveChild(m_xml.Nodes[column]);
                    m_xml.Nodes.Remove(column);
                    m_tvCollection.removeRow(selectedRows[0]);
                    m_tvCollection.update();
                    grid.update();
                }
                Native.invalidate();
                m_designerDiv.saveUndo();
            }
        }
示例#3
0
        /// <summary>
        /// 创建多页夹的页
        /// </summary>
        /// <param name="node">节点</param>
        /// <param name="control">控件</param>
        protected virtual void createTabPage(XmlNode node, FCView control)
        {
            FCTabControl tabControl = control as FCTabControl;

            if (tabControl != null)
            {
                FCTabPage tabPage = new FCTabPage();
                tabPage.Native = m_native;
                tabControl.addControl(tabPage);
                setAttributesBefore(node, tabPage);
                readChildNodes(node, tabPage);
                setAttributesAfter(node, tabPage);
                onAddControl(tabPage, node);
            }
        }
示例#4
0
 /// <summary>
 /// 显示
 /// </summary>
 public override void showDialog()
 {
     if (m_collectionName == "TabPages")
     {
         FCTabControl     tabControlA = m_target as FCTabControl;
         List <FCTabPage> tabPages    = tabControlA.getTabPages();
         int tabPagesSize             = tabPages.Count;
         for (int i = 0; i < tabPagesSize; i++)
         {
             FCTabPage  tabPage = tabPages[i];
             FCTreeNode node    = new FCTreeNode();
             node.setString(tabPage.Text);
             m_tvCollection.appendNode(node);
             node.Row.Tag = tabPage;
         }
     }
     else if (m_collectionName == "Columns")
     {
         FCGrid grid = m_target as FCGrid;
         List <FCGridColumn> columns = grid.getColumns();
         int columnsSize             = columns.Count;
         for (int i = 0; i < columnsSize; i++)
         {
             FCGridColumn column = columns[i];
             FCTreeNode   node   = new FCTreeNode();
             node.setString(column.Text);
             m_tvCollection.appendNode(node);
             node.Row.Tag = column;
         }
     }
     m_tvCollection.update();
     m_gridSelectedRowsChangedEvent = new FCEvent(gridSelectedRowsChanged);
     m_gridProperty.Xml             = m_xml;
     m_gridProperty.DesignerDiv     = m_designerDiv;
     m_tvCollection.addEvent(m_gridSelectedRowsChangedEvent, FCEventID.GRIDSELECTEDROWSCHANGED);
     if (m_tvCollection.getRows().Count > 0)
     {
         ArrayList <FCGridRow> selectedRows = new ArrayList <FCGridRow>();
         selectedRows.Add(m_tvCollection.getRow(0));
         m_tvCollection.SelectedRows = selectedRows;
     }
     base.showDialog();
 }
示例#5
0
        /// <summary>
        /// 重绘背景
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            FCNative native = Native;
            int      width = Width, height = Height;
            int      mw = width / 2, mh = height / 2;
            FCRect   drawRect     = new FCRect(0, 0, width, height);
            int      cornerRadius = 0;

            if (m_isClose)
            {
                long   lineColor   = FCDraw.FCCOLORS_LINECOLOR;
                FCRect ellipseRect = new FCRect(1, 1, width - 2, height - 2);
                //paint->FillEllipse(FCCOLORS_BACKCOLOR7, ellipseRect);
                paint.drawLine(lineColor, 2, 0, 4, 4, width - 7, height - 7);
                paint.drawLine(lineColor, 2, 0, 4, height - 7, width - 7, 3);
            }
            else
            {
                cornerRadius = 0;
                if (m_arrowType > 0)
                {
                    cornerRadius = 0;
                }
                FCView parent = Parent;
                if (parent != null)
                {
                    FCTabControl tabControl = parent as FCTabControl;
                    if (tabControl != null)
                    {
                        cornerRadius = 0;
                    }
                }
                paint.fillGradientRect(FCDraw.FCCOLORS_BACKCOLOR, FCDraw.FCCOLORS_BACKCOLOR2, drawRect, cornerRadius, 90);
                paint.drawRect(FCDraw.FCCOLORS_EXCOLOR1, 1, 0, drawRect);
                cornerRadius = 0;
                if (m_arrowType > 0)
                {
                    FCPoint point1 = new FCPoint();
                    FCPoint point2 = new FCPoint();
                    FCPoint point3 = new FCPoint();
                    int     dSize  = Math.Min(mw, mh) / 2;
                    switch (m_arrowType)
                    {
                    case 1:
                        point1.x = mw - dSize;
                        point1.y = mh;
                        point2.x = mw + dSize;
                        point2.y = mh - dSize;
                        point3.x = mw + dSize;
                        point3.y = mh + dSize;
                        break;

                    case 2:
                        point1.x = mw + dSize;
                        point1.y = mh;
                        point2.x = mw - dSize;
                        point2.y = mh - dSize;
                        point3.x = mw - dSize;
                        point3.y = mh + dSize;
                        break;

                    case 3:
                        point1.x = mw;
                        point1.y = mh - dSize;
                        point2.x = mw - dSize;
                        point2.y = mh + dSize;
                        point3.x = mw + dSize;
                        point3.y = mh + dSize;
                        break;

                    case 4:
                        point1.x = mw;
                        point1.y = mh + dSize;
                        point2.x = mw - dSize;
                        point2.y = mh - dSize;
                        point3.x = mw + dSize;
                        point3.y = mh - dSize;
                        break;
                    }
                    FCPoint[] points = new FCPoint[3];
                    points[0] = point1;
                    points[1] = point2;
                    points[2] = point3;
                    paint.fillPolygon(FCDraw.FCCOLORS_FORECOLOR, points);
                }
            }
            bool state = false;

            if (Selected)
            {
                state = true;
                paint.fillRoundRect(FCDraw.FCCOLORS_BACKCOLOR8, drawRect, cornerRadius);
            }
            else if (this == native.PushedControl)
            {
                state = true;
                paint.fillRoundRect(FCDraw.FCCOLORS_BACKCOLOR6, drawRect, cornerRadius);
            }
            else if (this == native.HoveredControl)
            {
                state = true;
                paint.fillRoundRect(FCDraw.FCCOLORS_BACKCOLOR5, drawRect, cornerRadius);
            }
            if (state)
            {
                if (cornerRadius > 0)
                {
                    paint.drawRoundRect(FCColor.Border, 2, 0, drawRect, cornerRadius);
                }
                else
                {
                    paint.drawRect(FCColor.Border, 1, 0, drawRect);
                }
            }
        }
示例#6
0
        /// <summary>
        /// 重绘背景
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void onPaintBackground(FCPaint paint, FCRect clipRect)
        {
            int    width = Width, height = Height;
            int    mw = width / 2, mh = height / 2;
            FCRect drawRect = new FCRect(0, 0, width, height);

            if (m_isClose)
            {
                long   lineColor   = FCDraw.FCCOLORS_LINECOLOR;
                FCRect ellipseRect = new FCRect(1, 1, width - 2, height - 2);
                paint.fillEllipse(FCDraw.FCCOLORS_UPCOLOR, ellipseRect);
                paint.drawLine(lineColor, 2, 0, 4, 4, width - 7, height - 7);
                paint.drawLine(lineColor, 2, 0, 4, height - 7, width - 7, 3);
            }
            else
            {
                int cornerRadius = 4;
                if (m_arrowType > 0)
                {
                    cornerRadius = 0;
                }
                FCView parent = Parent;
                if (parent != null)
                {
                    FCTabControl tabControl = parent as FCTabControl;
                    if (tabControl != null)
                    {
                        cornerRadius = 0;
                    }
                }
                paint.fillGradientRect(FCDraw.FCCOLORS_BACKCOLOR, FCDraw.FCCOLORS_BACKCOLOR2, drawRect, cornerRadius, 90);
                paint.drawRoundRect(FCDraw.FCCOLORS_LINECOLOR3, 1, 0, drawRect, cornerRadius);
            }
            if (m_arrowType > 0)
            {
                FCPoint[] points = new FCPoint[3];
                int       ts     = Math.Min(mw, mh) / 2;
                switch (m_arrowType)
                {
                //向左
                case 1:
                    points[0] = new FCPoint(mw - ts, mh);
                    points[1] = new FCPoint(mw + ts, mh - ts);
                    points[2] = new FCPoint(mw + ts, mh + ts);
                    break;

                //向右
                case 2:
                    points[0] = new FCPoint(mw + ts, mh);
                    points[1] = new FCPoint(mw - ts, mh - ts);
                    points[2] = new FCPoint(mw - ts, mh + ts);
                    break;

                //向上
                case 3:
                    points[0] = new FCPoint(mw, mh - ts);
                    points[1] = new FCPoint(mw - ts, mh + ts);
                    points[2] = new FCPoint(mw + ts, mh + ts);
                    break;

                //向下
                case 4:
                    points[0] = new FCPoint(mw, mh + ts);
                    points[1] = new FCPoint(mw - ts, mh - ts);
                    points[2] = new FCPoint(mw + ts, mh - ts);
                    break;
                }
                paint.fillPolygon(FCDraw.FCCOLORS_FORECOLOR, points);
            }
            //绘制选中效果
            if (paint.supportTransparent())
            {
                FCNative native = Native;
                if (Selected)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR2, drawRect);
                }
                else if (this == native.PushedControl)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR6, drawRect);
                }
                else if (this == native.HoveredControl)
                {
                    paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR5, drawRect);
                }
            }
        }
示例#7
0
        /// <summary>
        /// 添加类
        /// </summary>
        public void addClass()
        {
            XmlDocument xmlDoc = m_xml.XmlDoc;

            if (m_collectionName == "TabPages")
            {
                FCTabControl tabControl = m_target as FCTabControl;
                FCTabPage    tabPage    = new FCTabPage();
                tabControl.addControl(tabPage);
                String newControlName = UITemplate.CreateControlName(tabPage, m_xml);
                tabPage.Name = newControlName;
                tabPage.Text = newControlName;
                XmlNode tabControlNode = m_xml.Nodes[tabControl];
                XmlNode tabpageNode    = m_xml.XmlDoc.CreateNode(XmlNodeType.Element, "div", "");
                tabControlNode.AppendChild(tabpageNode);
                XmlAttribute xmlAtr1 = xmlDoc.CreateAttribute("name");
                xmlAtr1.Value = tabPage.Text;
                tabpageNode.Attributes.Append(xmlAtr1);
                XmlAttribute xmlAtr2 = xmlDoc.CreateAttribute("text");
                xmlAtr2.Value = tabPage.Text;
                tabpageNode.Attributes.Append(xmlAtr2);
                XmlAttribute xmlAtr3 = xmlDoc.CreateAttribute("type");
                xmlAtr3.Value = "tabpage";
                tabpageNode.Attributes.Append(xmlAtr3);
                m_xml.m_controls.Add(tabPage);
                m_xml.Nodes[tabPage] = tabpageNode;
                FCTreeNode node = new FCTreeNode();
                node.setString(tabPage.Name);
                m_tvCollection.appendNode(node);
                node.Row.Tag = tabPage;
                m_tvCollection.update();
                m_tvCollection.selectNextRow();
                tabControl.update();
            }
            else if (m_collectionName == "Columns")
            {
                FCGrid       grid   = m_target as FCGrid;
                FCGridColumn column = new FCGridColumn();
                grid.addColumn(column);
                String newControlName = UITemplate.CreateControlName(column, m_xml);
                column.Name = newControlName;
                column.Text = newControlName;
                XmlNode gridNode    = m_xml.Nodes[grid];
                XmlNode columnsNode = null;
                foreach (XmlNode subNode in gridNode.ChildNodes)
                {
                    if (subNode.Name.ToLower() == "columns" || subNode.Name.ToLower() == "tr")
                    {
                        columnsNode = subNode;
                        break;
                    }
                }
                if (columnsNode == null)
                {
                    columnsNode = xmlDoc.CreateNode(XmlNodeType.Element, "tr", "");
                    gridNode.AppendChild(columnsNode);
                }
                XmlNode columnNode = m_xml.XmlDoc.CreateNode(XmlNodeType.Element, "th", "");
                columnNode.InnerText = column.Text;
                columnsNode.AppendChild(columnNode);
                XmlAttribute xmlAtr1 = xmlDoc.CreateAttribute("name");
                xmlAtr1.Value = column.Text;
                columnNode.Attributes.Append(xmlAtr1);
                m_xml.m_controls.Add(column);
                m_xml.Nodes[column] = columnNode;
                FCTreeNode node = new FCTreeNode();
                node.setString(column.Name);
                m_tvCollection.appendNode(node);
                node.Row.Tag = column;
                grid.update();
            }
            m_tvCollection.update();
            m_tvCollection.selectNextRow();
            Native.invalidate();
            m_designerDiv.saveUndo();
        }