예제 #1
0
 /// <summary>
 /// 初始化模板列表
 /// </summary>
 private void FrmEditLeftList_Load(object sender, EventArgs e)
 {
     //获取模板名称集合
     foreach (object i in EditTemplateInfo.ReturnEditItemName())
     {
         //实例化模板集合中的子列表对象
         CustomEditList editlistchild = new CustomEditList(EditTemplateInfo.GetEditImg((i as string)));
         editlistchild.Tag  = (i as string);//存储当前子对象所对应的模板名称
         editlistchild.Dock = DockStyle.Top;
         P_editlist.Controls.Add(editlistchild);
     }
 }
예제 #2
0
        /// <summary>
        /// 重载构造函数|实现鹰眼的地图效果
        /// </summary>
        /// <param name="name">当前面板的底图名称</param>
        public FrmEagleLook(string name)
        {
            InitializeComponent();
            Image  imgzoom   = EditTemplateInfo.GetEditImg(name);
            int    imgwidth  = imgzoom.Width / 4;
            int    imgheight = imgzoom.Height / 4;
            Bitmap bmp       = new Bitmap(imgzoom, imgwidth, imgheight);

            PB_img.Width  = imgwidth;
            PB_img.Height = imgheight;
            PB_img.Image  = bmp;
        }
예제 #3
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);
            }
        }