/// <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(); }
/// <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(); }
/// <summary> /// 加载 /// </summary> /// <param name="name">名称</param> public void loadXml(String name) { if (name == "MainFrame") { m_xml = new MainFrame(); } m_xml.createNative(); m_native = m_xml.Native; m_native.Paint = new GdiPlusPaintEx(); m_host = new WinHostEx(); m_host.Native = m_native; m_native.Host = m_host; m_host.HWnd = Handle; m_native.AllowScaleSize = true; m_native.DisplaySize = new FCSize(ClientSize.Width, ClientSize.Height); m_xml.resetScaleSize(GetClientSize()); m_xml.Script = new FaceCatScript(m_xml); m_xml.Native.ResourcePath = DataCenter.getAppPath() + "\\config"; m_xml.load(DataCenter.getAppPath() + "\\config\\" + name + ".html"); m_host.ToolTip = new FCToolTip(); m_host.ToolTip.Font = new FCFont("SimSun", 20, true, false, false); (m_host.ToolTip as FCToolTip).InitialDelay = 250; m_native.update(); Invalidate(); }
/// <summary> /// 加载树的模板 /// </summary> /// <param name="tree">树</param> /// <param name="node">节点</param> public static void TreeTemplate(FCTree tree, UIXmlEx xml, XmlNode node) { XmlDocument xmlDoc = node.OwnerDocument; tree.Size = new FCSize(200, 200); FCGridColumn column = new FCGridColumn("Column1"); column.AllowSort = false; tree.addColumn(column); FCGridColumn column2 = new FCGridColumn("Column2"); column2.AllowSort = false; tree.addColumn(column2); tree.update(); FCTreeNode treeNode = new FCTreeNode(); treeNode.Text = "Node1"; tree.appendNode(treeNode); FCTreeNode subTreeNode = new FCTreeNode(); subTreeNode.Text = "Node2"; treeNode.appendNode(subTreeNode); tree.update(); XmlNode columnsNode = xmlDoc.CreateNode(XmlNodeType.Element, "tr", ""); node.AppendChild(columnsNode); XmlNode column1Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", ""); columnsNode.AppendChild(column1Node); XmlAttribute xmlAtr1 = xmlDoc.CreateAttribute("text"); xmlAtr1.Value = "Column1"; column1Node.Attributes.Append(xmlAtr1); XmlNode column2Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", ""); columnsNode.AppendChild(column2Node); XmlAttribute xmlAtr2 = xmlDoc.CreateAttribute("text"); xmlAtr2.Value = "Column2"; column2Node.Attributes.Append(xmlAtr2); XmlNode nodesNode = xmlDoc.CreateNode(XmlNodeType.Element, "nodes", ""); node.AppendChild(nodesNode); XmlNode nodeNode = xmlDoc.CreateNode(XmlNodeType.Element, "node", ""); nodesNode.AppendChild(nodeNode); XmlAttribute xmlAtr3 = xmlDoc.CreateAttribute("text"); xmlAtr3.Value = "Node1"; nodeNode.Attributes.Append(xmlAtr3); XmlNode subNodeNode = xmlDoc.CreateNode(XmlNodeType.Element, "node", ""); nodeNode.AppendChild(subNodeNode); XmlAttribute xmlAtr4 = xmlDoc.CreateAttribute("text"); xmlAtr4.Value = "Node2"; subNodeNode.Attributes.Append(xmlAtr4); }
/// <summary> /// 创建控件名称 /// </summary> /// <param name="control">控件</param> /// <param name="xml">XML对象</param> /// <returns>控件名称</returns> public static String CreateControlName(FCView control, UIXmlEx xml) { int count = 0; String controlType = control.getControlType(); String controlName = controlType; while (xml.findControl(controlName) != null) { if (count > 0) { controlName = controlType + (count + 1).ToString(); } count++; } return(controlName); }
/// <summary> /// 加载表格的模板 /// </summary> /// <param name="node">节点</param> public static void GridTemplate(FCGrid grid, UIXmlEx xml, XmlNode node) { XmlDocument xmlDoc = node.OwnerDocument; grid.Size = new FCSize(200, 200); FCGridColumn column = new FCGridColumn("Column1"); grid.addColumn(column); FCGridColumn column2 = new FCGridColumn("Column2"); grid.addColumn(column2); grid.update(); FCGridRow row = new FCGridRow(); grid.addRow(row); FCGridStringCell cell = new FCGridStringCell(); cell.setString("Cell1"); row.addCell(0, cell); FCGridStringCell cell2 = new FCGridStringCell(); cell2.setString("Cell2"); row.addCell(1, cell2); grid.update(); XmlNode columnsNode = xmlDoc.CreateNode(XmlNodeType.Element, "tr", ""); node.AppendChild(columnsNode); XmlNode column1Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", ""); column1Node.InnerText = "Column1"; columnsNode.AppendChild(column1Node); XmlNode column2Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", ""); column2Node.InnerText = "Column2"; columnsNode.AppendChild(column2Node); XmlNode rowNode = xmlDoc.CreateNode(XmlNodeType.Element, "tr", ""); node.AppendChild(rowNode); XmlNode cellNode1 = xmlDoc.CreateNode(XmlNodeType.Element, "td", ""); rowNode.AppendChild(cellNode1); cellNode1.InnerText = "Cell1"; XmlNode cellNode2 = xmlDoc.CreateNode(XmlNodeType.Element, "td", ""); rowNode.AppendChild(cellNode2); cellNode2.InnerText = "Cell2"; }
/// <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(); }
/// <summary> /// 添加模板 /// </summary> /// <param name="xml">XML对象</param> /// <param name="control">控件</param> public static void AttachTemplate(UIXmlEx xml, FCView control) { XmlNode node = xml.Nodes[control]; String newType = control.getControlType().ToLower(); if (newType == "grid") { GridTemplate(control as FCGrid, xml, node); } else if (newType == "layoutdiv") { LayoutDivTemplate(control as FCLayoutDiv, xml, node); } else if (newType == "splitlayoutdiv") { SplitLayoutDivTemplate(control as FCSplitLayoutDiv, xml, node); } else if (newType == "tablelayoutdiv") { TableLayoutDivTemplate(control as FCTableLayoutDiv, xml, node); } else if (newType == "tabcontrol") { TabControlTemplate(control as FCTabControl, xml, node); } else if (newType == "tree") { TreeTemplate(control as FCTree, xml, node); } else if (newType == "div") { control.Size = new FCSize(100, 100); } else if (newType == "calendar") { control.Size = new FCSize(200, 200); } else if (newType == "groupbox") { control.Size = new FCSize(100, 100); } else { control.Size = new FCSize(100, 20); } }
/// <summary> /// 删除 /// </summary> public void del() { m_isCut = true; if (m_designerTabPage.Visible) { m_copys.Clear(); UIXmlEx xml = m_resizeDiv.Xml; List <FCView> targets = m_resizeDiv.getTargets(); int targetsSize = targets.Count; for (int i = 0; i < targetsSize; i++) { xml.removeControl(targets[i]); } m_resizeDiv.clearTargets(); m_resizeDiv.Visible = false; m_native.invalidate(); } }
/// <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(); }
/// <summary> /// 销毁控件方法 /// </summary> public override void delete() { if (m_scintilla != null) { FCNative native = Native; WinHostEx host = native.Host as WinHostEx; Control container = Control.FromHandle(host.HWnd); if (container != null) { container.Controls.Remove(m_scintilla); m_scintilla.Dispose(); m_scintilla = null; } } if (m_xml != null) { m_xml.delete(); m_xml = null; } base.delete(); }
/// <summary> /// 打开文件 /// </summary> /// <param name="fileName">文件名</param> public void openFile(String fileName) { if (m_xml == null) { m_xml = new UIXmlEx(); m_xml.Native = Native; m_xml.DocumentChangedEvents.Add(new FCEvent(documentChanged)); FileInfo fileInfo = new FileInfo(fileName); if (fileInfo != null) { if (fileInfo.Directory != null) { DesignerTabPage.ResourcePath = fileInfo.Directory.FullName; } } } m_canModifyCaption = false; openXml(File.ReadAllText(fileName)); m_xmlPath = fileName; m_canModifyCaption = true; saveUndo(); }
/// <summary> /// 创建属性 /// </summary> public void createProperties() { WinHostEx host = Native.Host as WinHostEx; host.LoadingDesigner = true; int rowSize = m_rows.Count; if (rowSize > 0) { //清除所有行 for (int i = 0; i < rowSize; i++) { m_rows[i].clearCells(); m_rows[i].delete(); } m_rows.Clear(); } int targetsSize = m_targets.Count; if (targetsSize > 0) { FCView target = m_targets[0]; //获取属性名称 List <String> propertiesName = UIXmlEx.getUnionProperties(m_targets); Dictionary <String, String> addProperties = new Dictionary <String, String>(); if (targetsSize == 1) { if (target is FCTabControl) { addProperties["TabPages"] = "collection"; } else if (target is FCGrid) { addProperties["Columns"] = "collection"; } foreach (String addName in addProperties.Keys) { propertiesName.Add(addName); } } propertiesName.Sort(); int psize = propertiesName.Count; for (int i = 0; i < psize; i++) { String name = propertiesName[i]; String value = ""; String type = ""; if (addProperties.ContainsKey(name)) { value = "单击以编辑..."; type = addProperties[name]; } else { target.getProperty(name.ToLower(), ref value, ref type); } String text = name; if (m_chNames.ContainsKey(name.ToLower())) { text = m_chNames[name.ToLower()]; } if (value == null) { value = ""; } FCGridRow row = new FCGridRow(); addRow(row); //序号 GridNoCell orderCell = new GridNoCell(); row.addCell("NO", orderCell); //属性名称 FCGridStringCell nameCell = new FCGridStringCell(text); nameCell.Name = name; row.addCell("PROPERTYNAME", nameCell); //英文名称 FCGridStringCell enNameCell = new FCGridStringCell(name); row.addCell("ENNAME", enNameCell); //属性值 //布尔 if (type == "bool") { FCGridCheckBoxCell checkBoxCell = new FCGridCheckBoxCell(); checkBoxCell.Control = new CheckBoxM(); row.addCell("PROPERTYVALUE", checkBoxCell); checkBoxCell.setBool(value.ToLower() == "true" ? true : false); checkBoxCell.CheckBox.Tag = name; checkBoxCell.CheckBox.ButtonAlign = FCHorizontalAlign.Left; checkBoxCell.CheckBox.addEvent(new FCEvent(checkBoxCheckedChanged), FCEventID.CHECKEDCHANGED); } //枚举 else if (type.StartsWith("enum:")) { String strEnum = "FaceCat." + type.Replace("enum:", ""); String[] names = Enum.GetNames(m_assembly.GetType(strEnum)); FCGridComboBoxCell comboBoxCell = new FCGridComboBoxCell(); row.addCell("PROPERTYVALUE", comboBoxCell); comboBoxCell.ComboBox.BackColor = FCColor.None; int nameSize = names.Length; for (int j = 0; j < nameSize; j++) { comboBoxCell.ComboBox.DropDownMenu.addItem(new FCMenuItem(names[j])); } comboBoxCell.ComboBox.SelectedText = value; comboBoxCell.ComboBox.ReadOnly = true; comboBoxCell.ComboBox.Tag = name; comboBoxCell.ComboBox.addEvent(new FCEvent(comboBoxSelectedIndexChanged), FCEventID.SELECTEDINDEXCHANGED); } //集合 else if (type == "collection") { FCGridButtonCell buttonCell = new FCGridButtonCell(); row.addCell("PROPERTYVALUE", buttonCell); buttonCell.setString(value); buttonCell.Button.Tag = name; buttonCell.Button.BackColor = FCColor.None; buttonCell.Button.TextAlign = FCContentAlignment.MiddleLeft; buttonCell.Button.Font = new FCFont("微软雅黑", 12, false, false, false); } //颜色 else if (type == "color") { GridColorCell colorCell = new GridColorCell(); colorCell.AllowEdit = true; row.addCell("PROPERTYVALUE", colorCell); colorCell.setString(value); colorCell.Button.Font = new FCFont("微软雅黑", 12, true, false, false); } //字体 else if (type == "font") { GridFontCell fontCell = new GridFontCell(); fontCell.AllowEdit = true; row.addCell("PROPERTYVALUE", fontCell); fontCell.setString(value); fontCell.Button.Font = new FCFont("微软雅黑", 12, true, false, false); } //输入框 else { FCGridStringCell textCell = new FCGridStringCell(); textCell.AllowEdit = true; row.addCell("PROPERTYVALUE", textCell); textCell.Text = value; } } propertiesName.Clear(); update(); invalidate(); } host.LoadingDesigner = false; }
/// <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(); }