/// <summary>
        /// 添加一个函数框
        /// </summary>
        /// <param name="itbox"></param>
        public override void Add(IItemBox item)
        {
            LineItemBox itbox = item as LineItemBox;
            FunctionBox fb    = new FunctionBox();

            itbox.ContentX  = currentPosition.X;
            itbox.ContentY  = currentPosition.Y;
            fb.UIMain       = contentsCanvas;
            fb.DataContext  = itbox;
            itbox.Thickness = 6;
            Itemboxs.Add(itbox);
            fb.InitFunction();
            Add(fb);
        }
 /// <summary>
 /// 拖拽事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void XTreeView_Drop(object sender, DragEventArgs e)
 {
     try
     {
         ItemBox tobox   = getStackBoxOnDrap(e.OriginalSource as UIElement);
         ItemBox frombox = XTreeView.SelectedItem as ItemBox;
         if (tobox != null && frombox != null && tobox != frombox &&
             tobox.BoxType != ItemBoxEnum.IF && (tobox.BoxType == ItemBoxEnum.ELSE ||
                                                 tobox.BoxType == ItemBoxEnum.WHILE))
         {
             if (frombox.ParentNode == null)
             {
                 Itemboxs.Remove(frombox);
                 tobox.Add(frombox);
             }
             else
             {
                 frombox.ParentNode.Del(frombox);
                 tobox.Add(frombox);
             }
         }
         else if (tobox != null && frombox != null && tobox.BoxType == ItemBoxEnum.FUNCTION)
         {
             if (frombox.ParentNode == null)
             {
                 Itemboxs.Remove(frombox);
             }
             else
             {
                 frombox.ParentNode.Del(frombox);
             }
             if (tobox.ParentNode == null)
             {
                 Itemboxs.Insert(Itemboxs.IndexOf(tobox), frombox);
             }
             else
             {
                 tobox.ParentNode.Children.Insert(tobox.ParentNode.Children.IndexOf(tobox), frombox);
             }
         }
     }
     catch (Exception ex)
     {
         Log.ScriptLog.Log.Write(ex);
     }
 }
        /// <summary>
        /// 添加一个函数框
        /// </summary>
        /// <param name="itbox"></param>
        public void Add(IItemBox item, bool isaddposition)
        {
            LineItemBox itbox = item as LineItemBox;
            FunctionBox fb    = new FunctionBox();

            if (isaddposition == true)
            {
                itbox.ContentX = currentPosition.X;
                itbox.ContentY = currentPosition.Y;
            }
            fb.UIMain       = contentsCanvas;
            fb.DataContext  = itbox;
            itbox.Thickness = 6;
            Itemboxs.Add(itbox);
            fb.InitFunction();
            Add(fb);
        }