/// <summary>
 /// 左面板
 /// </summary>
 private void DockLeft()
 {
     //获取模板名称集合
     foreach (object i in EditTemplateInfo.ReturnEditItemName())
     {
         //实例化模板集合中的子列表对象
         FrmEditThempZoom editlistchild = new FrmEditThempZoom(EditTemplateInfo.GetEditImg((i as string)));
         editlistchild.Tag  = (i as string);//存储当前子对象所对应的模板名称
         editlistchild.Dock = DockStyle.Top;
         P_themplist.Controls.Add(editlistchild);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 生成模板
        /// </summary>
        /// <param name="editdoc">XML模板</param>
        private void InitCustomConfig(XmlDocument editdoc)
        {
            //模板底图
            Image img = EditTemplateInfo.GetEditImg(Editname);

            P_bgimg.Size            = new Size(img.Width, img.Height);
            P_bgimg.BackgroundImage = img;
            //模板中的控件
            P_bgimg.Controls.Clear();//清空模板控件
            //项模板
            foreach (XmlNode item in editdoc.DocumentElement.ChildNodes[4])
            {
                //属性项目|TabIndex索引
                int tabindex = Convert.ToInt32(EditTemplateMethod.GetXmlNodeTextInt(item.SelectSingleNode("TAB_INDEX"), "0"));
                //中文名
                string cname = EditTemplateMethod.GetXmlNodeText(item.SelectSingleNode("ITEM_CNAME"));
                //英文名
                string ename = EditTemplateMethod.GetXmlNodeText(item.SelectSingleNode("ITEM_ENAME"));
                //控件大小
                Size size = new Size(Convert.ToInt32(EditTemplateMethod.GetXmlNodeText(item.SelectSingleNode("ITEM_WIDTH"))), Convert.ToInt32(EditTemplateMethod.GetXmlNodeText(item.SelectSingleNode("ITEM_HEIGHT"))));
                //停靠在模板中的位置
                Point location = new Point(Convert.ToInt32(EditTemplateMethod.GetXmlNodeText(item.SelectSingleNode("POS_X"))), Convert.ToInt32(EditTemplateMethod.GetXmlNodeText(item.SelectSingleNode("POS_Y"))));
                //是否多行文本
                EditControlIsOrMultiline multiline = EditControlIsOrMultiline.FalseMultiline;
                if ((Convert.ToInt32(EditTemplateMethod.GetXmlNodeText(item.SelectSingleNode("MULTILINE"))) == 1))
                {
                    multiline = EditControlIsOrMultiline.TrueMultiline;
                }
                //是否自动换行
                EditControlIsOrWrap wrap = EditControlIsOrWrap.FalseWrap;
                if ((Convert.ToInt32(EditTemplateMethod.GetXmlNodeText(item.SelectSingleNode("WORD_WRAP"))) == 1))
                {
                    wrap = EditControlIsOrWrap.TrueWrap;
                }
                //默认控件类型为TextBoxText
                EditControlTypeInfo edittype = EditControlTypeInfo.TextBoxText;
                switch (EditTemplateMethod.GetXmlNodeText(item.SelectSingleNode("ITEM_TYPE")))
                {
                case "RichTextBox": edittype = EditControlTypeInfo.RichTextBox;
                    break;

                case "TextBoxText": edittype = EditControlTypeInfo.TextBoxText;
                    break;

                case "TextBoxNumber": edittype = EditControlTypeInfo.TextBoxNumber;
                    break;

                case "DateTimePicker": edittype = EditControlTypeInfo.DateTimePicker;
                    break;

                case "PictureBox": edittype = EditControlTypeInfo.PictureBox;
                    break;

                case "CheckBox": edittype = EditControlTypeInfo.CheckBox;
                    break;

                case "TextBoxLong": edittype = EditControlTypeInfo.TextBoxLong;
                    break;
                }
                CreateCustomControl(tabindex, cname, ename, size, location, multiline, wrap, edittype, BorderStyle.FixedSingle, true, ScrollBars.Both, RichTextBoxScrollBars.Both);
            }
        }