/// <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="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> /// <param name="node">节点</param> /// <param name="control">控件</param> public virtual void createSubProperty(XmlNode node, FCView control) { String name = node.Name.ToLower(); String controlType = null; if (control != null) { controlType = control.getControlType(); } if (name == "bands") { if (control is FCBandedGrid) { createBandedGridColumns(node, control); } } else if (name == "columns") { if (control is FCGrid) { createGridColumns(node, control); } } //下拉项 else if (name == "item" || name == "option") { //下拉列表 if (control is FCComboBox) { FCComboBox comboBox = control as FCComboBox; if (comboBox != null) { createMenuItem(node, comboBox.DropDownMenu, null); } } //菜单 else if (control is FCMenu) { FCMenu menu = control as FCMenu; if (menu != null) { createMenuItem(node, menu, null); } } } //树节点 else if (name == "nodes") { if (control is FCTree) { createTreeNodes(node, control); } } //行 else if (name == "rows") { if (control is FCGrid) { createGridRows(node, control); } } //多页夹 else if (name == "tabpage") { if (control is FCTabControl) { createTabPage(node, control); } } else if (name == "tr") { if (control is FCGrid) { FCGrid grid = control as FCGrid; if (grid.m_columns.size() == 0) { createGridColumns(node, control); } else { createGridRow(node, control); } } } }