private List <string> GetItem() { List <string> lstType = new List <string>(); //if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow is FormDesignerWorkbenchWindow) //{ //if (((FormDesignerWorkbenchWindow)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow).SelectedControl.formItemID.ToString() != "0" // && ((FormDesignerWorkbenchWindow)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow).SelectedControl.formItemID.ToString() != null) //{ DockFormDesigner win = (DockFormDesigner)DockWindowFactory.Instance.CurrDockWindow; foreach (XmlNode item in ControlMapping.GetInstance().GetControlExtention(win.SelectedControl.formItemType.ToString())) { if (item.Attributes == null) { continue; } if (item.Attributes["name"] != null) { lstType.Add(item.Attributes["name"].Value); } } //} //} return(lstType); }
private List <string> GetItem() { List <string> lstControls = new List <string>(); if (DockWindowFactory.Instance.CurrDockWindow is DockFormDesigner) { DockFormDesigner win = (DockFormDesigner)DockWindowFactory.Instance.CurrDockWindow; if (win.SelectedControl.formItemID.ToString() != "0" && win.SelectedControl.formItemID.ToString() != null) { lstControls.Add(string.Empty); foreach (KeyValuePair <int, string> item in DockFormDesigner.controlDictionary) { lstControls.Add(item.Value); } } } return(lstControls); }
/// <summary> /// 生成表单文件 /// </summary> /// <param name="formDesignerWorkbenchWindow"></param> /// <param name="FilePath"></param> /// <returns></returns> //public bool Execute(FormDesignerWorkbenchWindow formDesignerWorkbenchWindow, out string xmlString) //{ // bool isCheckerok = true; // xmlString = string.Empty; // try // { // List<object> list = new List<object>(); // list.Add(formDesignerWorkbenchWindow.formValidatesCollection); // //list.Add(formDesignerWorkbenchWindow.dataDefineResource); // list.Add(formDesignerWorkbenchWindow.formDataCollection); // list.Add(formDesignerWorkbenchWindow.formRightsCollection); // BuildRuleChecker.CheckReference(formDesignerWorkbenchWindow); // string message = string.Empty; // if (isCheckerok) // { // xmlString = DistFormXmlBuilder.BuildXml(list,formDesignerWorkbenchWindow, // formDesignerWorkbenchWindow.SheetLayoutXML); // } // } // catch(Exception E) // { // isCheckerok = false; // MessageBox.Show(E.Message); // } // return isCheckerok; //} /// <summary> /// 读取单个表单文件 /// </summary> /// <param name="dockFormDesigner"></param> /// <param name="filePath"></param> public void ResetXml(DockFormDesigner dockFormDesigner, string fileContent) { #region //控件 FormXmlParser formXmlParser = new FormXmlParser(fileContent, true); PageProperty.IsPrint = formXmlParser.GetPrintProperty("/Form", "isprint"); Dictionary <string, string> dic = new Dictionary <string, string>(); ControlCollection controlCollection = formXmlParser.GetControls(dockFormDesigner, "/Form/Control", out dic); string width, height; dic.TryGetValue("width", out width); dic.TryGetValue("height", out height); FormProvoider.SetFormViewSize(Convert.ToInt32(width), Convert.ToInt32(height)); foreach (KeyValuePair <string, object> kvp in controlCollection) { #region FormItemType == 5 if (((GeneralAttribute)kvp.Value).FormItemType == 5) { FormProvoider.Rect rcRect = new FormProvoider.Rect(); SetRect(out rcRect, (GeneralAttribute)kvp.Value); FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType), rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType); TableContorlAttribute tableContorlAttribute = (TableContorlAttribute)kvp.Value; int page = 0; foreach (KeyValuePair <string, Group> kvpGroup in tableContorlAttribute.Groups) { FormProvoider.InsertTabPage(((GeneralAttribute)kvp.Value).FormItemId, kvpGroup.Value.Name, page); foreach (KeyValuePair <string, GeneralAttribute> kvpChildAttribute in kvpGroup.Value.GroupControls) { FormProvoider.Rect rcRectChild = new FormProvoider.Rect(); SetRect(out rcRectChild, (GeneralAttribute)kvpChildAttribute.Value); FormProvoider.CreateChlidFormItem(kvpChildAttribute.Value.FormItemType, rcRectChild, Convert.ToInt32(kvpChildAttribute.Key), Convert.ToInt32(kvp.Key), page, ((GeneralAttribute)kvpChildAttribute.Value).ExtensionType); if (((GeneralAttribute)kvpChildAttribute.Value).Multiline == true && ((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 1) { FormProvoider.SetFormItemStyle(Convert.ToInt32(kvpChildAttribute.Key), 0x00010000, true);//0x00010000 } if (((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 7) { //SetDataGrid(formDesignerWorkbenchWindow, kvpChildAttribute.Key, kvpChildAttribute.Value); } if (((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 20) { SetRadioButtonList(kvpChildAttribute.Value); } if (((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 4 || ((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 15 || ((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 3 || ((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 6) { FormProvoider.SetStaticText(Convert.ToInt32(kvpChildAttribute.Key), kvpChildAttribute.Value.Text); } if (((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 4) { FormProvoider.FontWnd font = new FormProvoider.FontWnd(); font.itemName = ((GeneralAttribute)kvpChildAttribute.Value).WindowTextFont.FontFamily.Name; font.ftSize = Convert.ToInt32(((GeneralAttribute)kvpChildAttribute.Value).WindowTextFont.Size); font.ftStyle = GeneralAttribute.GetFontStyle(((GeneralAttribute)kvpChildAttribute.Value).WindowTextFont); FormProvoider.SetFormItemFont(((GeneralAttribute)kvpChildAttribute.Value).FormItemId, font); FormProvoider.SetFormItemStyle(((GeneralAttribute)kvpChildAttribute.Value).FormItemId, 0x00800000, ((GeneralAttribute)kvpChildAttribute.Value).Border); } } page++; } } #endregion else if (((GeneralAttribute)kvp.Value).FormItemType == 7) { FormProvoider.Rect rcRect = new FormProvoider.Rect(); SetRect(out rcRect, (GeneralAttribute)kvp.Value); FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType), rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType); //SetDataGrid(formDesignerWorkbenchWindow, kvp.Key, kvp.Value); } else if (((GeneralAttribute)kvp.Value).FormItemType == 20) { FormProvoider.Rect rcRect = new FormProvoider.Rect(); SetRect(out rcRect, (GeneralAttribute)kvp.Value); FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType), rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType); SetRadioButtonList(kvp.Value); } else if (((GeneralAttribute)kvp.Value).FormItemType == 255)//直线 { FormProvoider.Rect rcRect = new FormProvoider.Rect(); SetRect(out rcRect, (GeneralAttribute)kvp.Value); FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType), rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType); } else { FormProvoider.Rect rcRect = new FormProvoider.Rect(); SetRect(out rcRect, (GeneralAttribute)kvp.Value); FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType), rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType); if (((GeneralAttribute)kvp.Value).FormItemType == 1) { DockFormDesigner.controlIdItems.Add(kvp.Key); } else { FormProvoider.SetStaticText(Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).Text); } //Dap2xProvoider.SetFormItemStyle(((GeneralAttribute)kvp.Value).FormItemId, 0x00800000, false); if (((GeneralAttribute)kvp.Value).FormItemType == 1 && ((GeneralAttribute)kvp.Value).Multiline == true) { FormProvoider.SetFormItemStyle(((GeneralAttribute)kvp.Value).FormItemId, 0x00010000, true); } else { FormProvoider.SetFormItemStyle(((GeneralAttribute)kvp.Value).FormItemId, 0x00010000, false); } if (((GeneralAttribute)kvp.Value).FormItemType == 4) { FormProvoider.FontWnd font = new FormProvoider.FontWnd(); font.itemName = ((GeneralAttribute)kvp.Value).WindowTextFont.FontFamily.Name; font.ftSize = Convert.ToInt32(((GeneralAttribute)kvp.Value).WindowTextFont.Size); font.ftStyle = GeneralAttribute.GetFontStyle(((GeneralAttribute)kvp.Value).WindowTextFont); FormProvoider.SetFormItemFont(((GeneralAttribute)kvp.Value).FormItemId, font); Color color = ((GeneralAttribute)kvp.Value).WindowTextColor; FormProvoider.SetFormItemColor(((GeneralAttribute)kvp.Value).FormItemId, color.B << 16 | color.G << 8 | color.R); //边框 FormProvoider.SetFormItemStyle(((GeneralAttribute)kvp.Value).FormItemId, 0x00800000, ((GeneralAttribute)kvp.Value).Border); } } } #endregion //formDesignerWorkbenchWindow.formDataCollection = formDesignerWorkbenchWindow.FormParameter.FormDataCollection; //formDesignerWorkbenchWindow.formValidatesCollection = getObjectFromXml.GetFormValidatesCollection("/Form/Validation");//formValidatesCollection //formDesignerWorkbenchWindow.formRightsCollection = getObjectFromXml.GetFormRightsCollection("/Form/Right");//formRightsCollection ////zhanben20100919 新增表单脚本功能 //formDesignerWorkbenchWindow.FormScriptString = getObjectFromXml.GetFormScriptString("/Form/Script"); }
public static void ReLoadDataBinding(DockFormDesigner formDesignerWorkbenchWindow) { //formDesignerWorkbenchWindow.formDataCollection =formDesignerWorkbenchWindow.FormParameter.FormDataCollection;// DistFormXmlParser.ReGetFormDataCollection( }
/// <summary> /// 获取控件信息集 /// </summary> /// <param name="xPath"></param> /// <returns></returns> public ControlCollection GetControls(DockFormDesigner dockFormDesigner, string xPath, out Dictionary <string, string> panelProperty) { _dockFormDesigner = dockFormDesigner; ControlCollection controlCollection = new ControlCollection(); XmlNode contorlNodes = formXmlParser.GetNode(xPath); panelProperty = new Dictionary <string, string>(); //textBoxsType = new TextBoxsType(); panelProperty.Add("width", contorlNodes.Attributes["width"].Value); panelProperty.Add("height", contorlNodes.Attributes["height"].Value); DockFormDesigner.controlDictionary.Clear(); foreach (XmlNode xmlnode in contorlNodes) { GeneralAttribute generalAttribute = new GeneralAttribute(); Int16 ItemType = 0; ItemType = Convert.ToInt16(ControlMapping.GetInstance().GetFormItemType(xmlnode.Name)); switch (ItemType) { case 5: #region ItemType=5 TableContorlAttribute tableContorlAttribute = new TableContorlAttribute(); BindGeneralAttribute(tableContorlAttribute, xmlnode, Convert.ToInt16(ControlMapping.GetInstance().GetFormItemType(xmlnode.Name))); foreach (XmlNode groupNode in xmlnode) { Group group = new Group(); group.Name = groupNode.Attributes["name"].Value; foreach (XmlNode childNode in groupNode) { Int16 ItemTypec; //if (childNode.Name == "DateTimePicker") //{ // ItemTypec = 1; // textBoxsType.AddTextBox(childNode.Attributes["id"].Value); //} //else ItemTypec = Convert.ToInt16(ControlMapping.GetInstance().GetFormItemType(childNode.Name)); switch (ItemTypec) { case 7: DataGridControlAttribute DataGridControlAttribute = AppendGrid(childNode); group.AddGroupControl(DataGridControlAttribute.ControlId, DataGridControlAttribute); break; case 20: RadioButtonListAttribute rbtlist = AppendRadioButton(childNode); group.AddGroupControl(rbtlist.ControlId, rbtlist); break; default: GeneralAttribute childContrlAttribute = new GeneralAttribute(); BindGeneralAttribute(childContrlAttribute, childNode, ItemTypec); group.AddGroupControl(childContrlAttribute.ControlId, childContrlAttribute); break; } } tableContorlAttribute.AddGroup(group.Name, group); } generalAttribute = tableContorlAttribute; #endregion break; case 7: generalAttribute = AppendGrid(xmlnode); break; case 20: generalAttribute = AppendRadioButton(xmlnode); break; default: BindGeneralAttribute(generalAttribute, xmlnode, ItemType); break; } controlCollection.Add(xmlnode.Attributes["id"].Value, generalAttribute); } return(controlCollection); }