예제 #1
0
 /// <summary>
 /// 粘贴
 /// </summary>
 public void paste()
 {
     if (m_sourceCodeTabPage.Visible)
     {
         m_scintilla.Clipboard.Paste();
     }
     else
     {
         int copysSize = m_copys.Count;
         if (copysSize > 0)
         {
             UIXmlEx targetXml = Xml;
             FCPoint mp        = m_native.TouchPoint;
             //查找控件
             List <FCView> targets     = m_resizeDiv.getTargets();
             int           targetsSize = targets.Count;
             if (targetsSize > 0)
             {
                 FCView targetControl = targets[0];
                 if (!targetXml.isContainer(targetControl))
                 {
                     targetControl = targetControl.Parent;
                 }
                 if (targetControl != null && targetXml.containsControl(targetControl))
                 {
                     for (int i = 0; i < copysSize; i++)
                     {
                         FCView control = m_copys[i];
                         if (m_xml.containsControl(control))
                         {
                             targetXml.copyControl(UITemplate.CreateControlName(control, m_xml), control, targetControl);
                             if (m_isCut)
                             {
                                 m_xml.removeControl(control);
                             }
                             break;
                         }
                     }
                 }
             }
         }
     }
     m_isCut = false;
     m_copys.Clear();
     m_native.invalidate();
 }
예제 #2
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();
        }