Example #1
0
        /// <summary>
        /// 将XML对象转换回CodeBox对象
        /// </summary>
        /// <param name="boxElement"></param>
        /// <returns></returns>
        public static void ReadCodeBoxObject(XmlNode boxnode, PicTabPage pic)
        {
            XmlElement boxElement = (XmlElement)boxnode;
            //CodeBox ReBox = new CodeBox();
            int    Id    = int.Parse(boxElement.GetAttribute("ID"));
            string Title = boxElement.GetAttribute("Title");
            string Hint  = boxElement.GetAttribute("HitText");

            CodeBox.XAType CodeboxType = CodeBox.CodeBoxTypeMapping(boxElement.GetAttribute("CodeBoxType"));
            Point          position    = new Point();

            position.X = float.Parse(boxElement.GetAttribute("PositionX"));
            position.Y = float.Parse(boxElement.GetAttribute("PositionY"));
            string SystemCodeString = boxElement.GetAttribute("SystemCodeString");
            string ReturnValueName  = boxElement.GetAttribute("ReturnValueName");
            ///加载一个CodeBox
            CodeBox ReBox = pic.LoadXCodeBox(Title, position, Id, CodeboxType);

            ReBox.SystemCodeString = SystemCodeString;
            ReBox.ReturnValueName  = ReturnValueName;
            ///循环左边属性
            XmlNode LeftXAribute = boxnode.SelectSingleNode("LeftXAribute");

            foreach (XmlNode node in LeftXAribute.SelectNodes("XAribute"))
            {
                ReadXAributeObject(node, ReBox);
            }
            ///循环右边属性
            XmlNode RightXAribute = boxnode.SelectSingleNode("RightXAribute");

            foreach (XmlNode node in RightXAribute.SelectNodes("XAribute"))
            {
                ReadXAributeObject(node, ReBox);
            }
        }
Example #2
0
        /// <summary>
        /// 从文件中加载一个代码块
        /// </summary>
        /// <param name="name"></param>
        /// <param name="position"></param>
        /// <param name="id"></param>
        /// <param name="CodeboxType"></param>
        /// <returns></returns>
        public CodeBox LoadXCodeBox(string name, Point position, int id, CodeBox.XAType CodeboxType = CodeBox.XAType.XFunction)
        {
            CodeBox box = new CodeBox(id, this, name, ChileEventCallBack, CodeboxType);

            box.SetPosition(position);
            //xa.AddAttribute(XRadioButton.XAttributeType.XEnter, XRadioButton.XPositonStyle.Left);
            ListCodeBoxChild.Add(id, box);
            this.Children.Add(box);
            return(box);
        }
Example #3
0
        /// <summary>
        /// 创建一个代码块
        /// </summary>
        /// <param name="name"></param>
        /// <param name="id"></param>
        public CodeBox CreateXCodeBox(string name, Point position, CodeBox.XAType CodeboxType = CodeBox.XAType.XFunction)
        {
            int     id = CreadCodeBoxID();
            CodeBox xa = new CodeBox(id, this, name, ChileEventCallBack, CodeboxType);

            xa.SetPosition(position);
            //xa.AddAttribute(XRadioButton.XAttributeType.XEnter, XRadioButton.XPositonStyle.Left);
            ListCodeBoxChild.Add(id, xa);
            this.Children.Add(xa);
            return(xa);
        }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="ChildrenItem">子项集合</param>
 /// <param name="XName">显示用的名字</param>
 /// <param name="TypeImagePath">显示类型的图片</param>
 /// <param name="MyXaributeChildren">代码块中所存在的属性集合</param>
 /// <param name="MyHitText">MyHitText</param>
 public MyXTreeItem(List <MyXTreeItem> ChildrenItem, string XName,
                    string TypeImagePath, List <XAributeItem> MyXaributeChildren, string MyHitText, CodeBox.XAType MyCodeBoxType
                    , string SystemCodeString, string ReturnValue)
 {
     this.ChildrenItem       = ChildrenItem;
     this.XName              = XName;
     this.TypeImagePath      = TypeImagePath;
     this.MyXaributeChildren = MyXaributeChildren;
     this.IsExpanded         = false;
     this.MyHitText          = MyHitText;
     this.MyCodeBoxType      = MyCodeBoxType;
     this.SystemCodeString   = SystemCodeString;
     this.ReturnValue        = ReturnValue;
 }