コード例 #1
0
        /// <summary>
        /// 添加函数框
        /// </summary>
        /// <param name="fb"></param>
        protected override void Add(IFunctionBox ffb)
        {
            FunctionBox fb = ffb as FunctionBox;

            contentsCanvas.Children.Add(fb);
            iFunctionBoxs.Add(fb);
            fb.MouseEnter += Fb_MouseEnter;
            fb.MouseLeave += Fb_MouseLeave;
        }
コード例 #2
0
 /// <summary>
 /// 设置呗框选的盒子
 /// </summary>
 /// <param name="rect"></param>
 protected void setSelectedBox(Rect rect)
 {
     foreach (var ibox in iFunctionBoxs)
     {
         FunctionBox item = ibox as FunctionBox;
         if (this.selectedBoxs.Contains(item) == false && Tools.IsContinsRect(rect, item.Rect))
         {
             (item.Ibox).Thickness = 6;
             Canvas.SetZIndex(item, 100);
             this.selectedBoxs.Add(item);
         }
     }
 }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        /// <summary>
        /// 删除一个
        /// </summary>
        /// <param name="fb"></param>
        public void Del(FunctionBox fb)
        {
            if (iFunctionBoxs.Contains(fb))
            {
                iFunctionBoxs.Remove(fb);
            }
            if (contentsCanvas.Children.Contains(fb))
            {
                contentsCanvas.Children.Remove(fb);
            }
            fb.MouseEnter -= Fb_MouseEnter;
            fb.MouseLeave -= Fb_MouseLeave;

            foreach (var item in fb.Inputs)
            {
                List <BezierLine> bzs = new List <BezierLine>((item as MLParatItemLayout).LinksBezierLine);
                if (bzs.Count != 0)
                {
                    foreach (var bz in bzs)
                    {
                        Del(bz);
                    }
                }
                bzs.Clear();
                bzs = null;
            }
            foreach (var item in fb.Outputs)
            {
                List <BezierLine> bzs = new List <BezierLine>((item as MLParatItemLayout).LinksBezierLine);
                if (bzs.Count != 0)
                {
                    foreach (var bz in bzs)
                    {
                        Del(bz);
                    }
                }
                bzs.Clear();
                bzs = null;
            }
            IItemBox ibox = fb.Ibox;

            if (ibox != null)
            {
                this.Itemboxs.Remove(ibox);
            }
            fb.DataContext = null;
            fb             = null;
        }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
 /// <summary>
 /// 鼠标进入
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Fb_MouseEnter(object sender, MouseEventArgs e)
 {
     currentMouseOverFunctionBox = sender as FunctionBox;
 }
コード例 #7
0
 /// <summary>
 /// 鼠标离开
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Fb_MouseLeave(object sender, MouseEventArgs e)
 {
     currentMouseOverFunctionBox = null;
 }