예제 #1
0
        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="name">节点名称</param>
        public void AddFlowChartItem(string name)
        {
            FlowChartItem item = new FlowChartItem();

            item.Name = name;
            AddFlowChartItem(item);
        }
예제 #2
0
        private void BringItemToFront(FlowChartItem item)
        {
            int max = 0;

            foreach (var obj in _FlowChartItem)
            {
                if (obj.Level > max)
                {
                    max = obj.Level;
                }
            }
            item.Level = max + 1;


            if (max > 1000)
            {
                int n = 0;
                List <FlowChartItem> list = _FlowChartItem.OrderBy(obj => obj.Level).ToList();
                foreach (var obj in list)
                {
                    obj.Level = n++;
                }
            }
            DrawItems();
        }
예제 #3
0
        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="name">节点名称</param>
        /// <param name="rect">节点区域</param>
        public void AddFlowChartItem(string name, Rectangle rect)
        {
            FlowChartItem item = new FlowChartItem();

            item.Name = name;
            item.Rect = rect;
            AddFlowChartItem(item);
        }
예제 #4
0
        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="rect">节点区域</param>
        public void AddFlowChartItem(Rectangle rect)
        {
            FlowChartItem item = new FlowChartItem();

            item.Name = "新建模块" + (_FlowChartItem.Count + 1).ToString();
            item.Rect = rect;
            AddFlowChartItem(item);
        }
예제 #5
0
        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="name">节点名称</param>
        /// <param name="formmodel">节点连接模块</param>
        public void AddFlowChartItem(string name, string formmodel)
        {
            FlowChartItem item = new FlowChartItem();

            item.Name      = name;
            item.FormModel = formmodel;
            AddFlowChartItem(item);
        }
예제 #6
0
        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="name">节点名称</param>
        /// <param name="rect">节点区域</param>
        /// <param name="tooltip">提示信息</param>
        public void AddFlowChartItem(string name, Rectangle rect, string tooltip)
        {
            FlowChartItem item = new FlowChartItem();

            item.Name    = name;
            item.Rect    = rect;
            item.ToolTip = tooltip;
            AddFlowChartItem(item);
        }
예제 #7
0
        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="name">节点名称</param>
        /// <param name="rect">节点区域</param>
        /// <param name="backcolor">背景颜色</param>
        public void AddFlowChartItem(string name, Rectangle rect, Color backcolor)
        {
            FlowChartItem item = new FlowChartItem();

            item.Name      = name;
            item.Rect      = rect;
            item.BackColor = backcolor;
            AddFlowChartItem(item);
        }
예제 #8
0
        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="name">节点名称</param>
        /// <param name="rect">节点区域</param>
        /// <param name="tooltip">提示信息</param>
        /// <param name="formmodel">节点连接模块</param>
        public void AddFlowChartItem(string name, Rectangle rect, string tooltip, string formmodel)
        {
            FlowChartItem item = new FlowChartItem();

            item.Name      = name;
            item.Rect      = rect;
            item.ToolTip   = tooltip;
            item.FormModel = formmodel;
            AddFlowChartItem(item);
        }
예제 #9
0
        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="name">节点名称</param>
        /// <param name="rect">节点区域</param>
        /// <param name="backcolor">背景颜色</param>
        /// <param name="tooltip">提示信息</param>
        /// <param name="tag">节点Tag</param>
        public void AddFlowChartItem(string name, Rectangle rect, Color backcolor, string tooltip, string tag)
        {
            FlowChartItem item = new FlowChartItem();

            item.Name      = name;
            item.Rect      = rect;
            item.BackColor = backcolor;
            item.ToolTip   = tooltip;
            item.Tag       = tag;
            AddFlowChartItem(item);
        }
예제 #10
0
 private FlowChartItem GetPointItemName(int x, int y)
 {
     for (int i = _FlowChartItem.Count - 1; i >= 0; i--)
     {
         FlowChartItem obj = _FlowChartItem[i];
         if (x >= obj.Rect.Left && x <= obj.Rect.Right && y >= obj.Rect.Top && y <= obj.Rect.Bottom)
         {
             Cursor = Cursors.Hand;
             return(obj);
         }
     }
     return(null);
 }
예제 #11
0
 private FlowChartItem GetMouseOverItemRect(int x, int y)
 {
     for (int i = _FlowChartItem.Count - 1; i >= 0; i--)
     {
         FlowChartItem obj = _FlowChartItem[i];
         if (x >= obj.Rect.Left + 3 && x <= obj.Rect.Right - 3 && y >= obj.Rect.Top + 3 && y <= obj.Rect.Bottom - 3)
         {
             Cursor = Cursors.Hand;
             return(obj);
         }
     }
     return(null);
 }
예제 #12
0
        /// <summary>
        /// 根据名称删除节点
        /// </summary>
        /// <param name="name">节点名称</param>
        public void DeleteItem(string name)
        {
            FlowChartItem di = _FlowChartItem.FirstOrDefault(o => o.Name.Equals(name));

            if (di != null)
            {
                _FlowChartItem.Remove(di);
                if (di.Name.Equals(_CurrentItemName))
                {
                    _CurrentItemName = "";
                    _CurrentItem     = null;
                }
            }
            DrawItems();
        }
예제 #13
0
        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="name">节点名称</param>
        /// <param name="rect">节点区域</param>
        /// <param name="backcolor">背景颜色</param>
        /// <param name="forecolor">字体颜色</param>
        /// <param name="tooltip">提示信息</param>
        /// <param name="tag">节点Tag</param>
        /// <param name="backimg">背景图片</param>
        /// <param name="bordercolor">边框颜色</param>
        /// <param name="formmodel">连接窗体</param>
        /// <param name="fnt">字体</param>
        public void AddFlowChartItem(string name, Rectangle rect, Color backcolor, Color forecolor, Color bordercolor, string tooltip, string tag, string formmodel, Image backimg, Font fnt)
        {
            FlowChartItem item = new FlowChartItem();

            item.Name        = name;
            item.Rect        = rect;
            item.BackColor   = backcolor;
            item.ForeColor   = forecolor;
            item.ToolTip     = tooltip;
            item.Tag         = tag;
            item.BorderColor = bordercolor;
            item.FormModel   = formmodel;
            item.BackImage   = backimg;
            item.TextFont    = fnt;
            AddFlowChartItem(item);
        }
예제 #14
0
 /// <summary>
 /// 删除所有节点
 /// </summary>
 public void DeleteItem()
 {
     for (int i = 0; i < _FlowChartItem.Count; i++)
     {
         FlowChartItem di = _FlowChartItem.FirstOrDefault(o => o.Name.Equals(_FlowChartItem[i].Name));
         if (di != null)
         {
             _FlowChartItem.Remove(di);
             if (di.Name.Equals(_CurrentItemName))
             {
                 _CurrentItemName = "";
                 _CurrentItem     = null;
             }
         }
         DrawItems();
     }
     if (_FlowChartItem.Count > 0)
     {
         DeleteItem();
     }
 }
예제 #15
0
        private void BWSFlowChart_MouseDown(object sender, MouseEventArgs e)
        {
            //if (e.Button == MouseButtons.Left)
            //{
            string oldName = _CurrentItemName;

            _CurrentItem = GetPointItemName(e.X, e.Y);
            _CurrentLine = GetPointLineName(e.X, e.Y);
            if (_CurrentItem != null)
            {
                IsOnClickEventHander = true;
                _CurrentItemName     = _CurrentItem.Name;
                BringItemToFront(_CurrentItem);
                _ItemX = e.X;
                _ItemY = e.Y;
            }
            else
            {
                _CurrentItemName = "";
            }


            if (!oldName.Equals(_CurrentItemName))
            {
                DrawItems();
            }
            //}
            if (e.Button == MouseButtons.Right)
            {
                if (_CurrentItem != null && IsDesignMode)
                {
                    cmsMenu.Show(this, e.X, e.Y);
                }
                if (_CurrentLine != null && IsDesignMode)
                {
                    cmsLine.Show(this, e.X, e.Y);
                }
            }
        }
예제 #16
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="name">节点名称</param>
 /// <param name="rect">节点区域</param>
 /// <param name="tooltip">提示信息</param>
 public void AddFlowChartItem(string name, Rectangle rect, string tooltip)
 {
     FlowChartItem item = new FlowChartItem();
     item.Name = name;
     item.Rect = rect;
     item.ToolTip = tooltip;
     AddFlowChartItem(item);
 }
예제 #17
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="name">节点名称</param>
 /// <param name="rect">节点区域</param>
 /// <param name="backcolor">背景颜色</param>
 public void AddFlowChartItem(string name, Rectangle rect, Color backcolor)
 {
     FlowChartItem item = new FlowChartItem();
     item.Name = name;
     item.Rect = rect;
     item.BackColor = backcolor;
     AddFlowChartItem(item);
 }
예제 #18
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="name">节点名称</param>
 /// <param name="rect">节点区域</param>
 /// <param name="tooltip">提示信息</param>
 /// <param name="formmodel">节点连接模块</param>
 public void AddFlowChartItem(string name, Rectangle rect, string tooltip, string formmodel)
 {
     FlowChartItem item = new FlowChartItem();
     item.Name = name;
     item.Rect = rect;
     item.ToolTip = tooltip;
     item.FormModel = formmodel;
     AddFlowChartItem(item);
 }
예제 #19
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="name">节点名称</param>
 /// <param name="formmodel">节点连接模块</param>
 public void AddFlowChartItem(string name, string formmodel)
 {
     FlowChartItem item = new FlowChartItem();
     item.Name = name;
     item.FormModel = formmodel;
     AddFlowChartItem(item);
 }
예제 #20
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="name">节点名称</param>
 /// <param name="rect">节点区域</param>
 /// <param name="backcolor">背景颜色</param>
 /// <param name="forecolor">字体颜色</param>
 /// <param name="tooltip">提示信息</param>
 /// <param name="tag">节点Tag</param>
 public void AddFlowChartItem(string name, Rectangle rect, Color backcolor, Color forecolor, string tooltip, string tag)
 {
     FlowChartItem item = new FlowChartItem();
     item.Name = name;
     item.Rect = rect;
     item.BackColor = backcolor;
     item.ForeColor = forecolor;
     item.ToolTip = tooltip;
     item.Tag = tag;
     AddFlowChartItem(item);
 }
예제 #21
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="name">节点名称</param>
 /// <param name="rect">节点区域</param>
 /// <param name="backcolor">背景颜色</param>
 /// <param name="forecolor">字体颜色</param>
 /// <param name="tooltip">提示信息</param>
 /// <param name="tag">节点Tag</param>
 /// <param name="backimg">背景图片</param>
 /// <param name="bordercolor">边框颜色</param>
 /// <param name="formmodel">连接窗体</param>
 /// <param name="fnt">字体</param>
 public void AddFlowChartItem(string name, Rectangle rect, Color backcolor, Color forecolor, Color bordercolor, string tooltip, string tag, string formmodel, Image backimg, Font fnt)
 {
     FlowChartItem item = new FlowChartItem();
     item.Name = name;
     item.Rect = rect;
     item.BackColor = backcolor;
     item.ForeColor = forecolor;
     item.ToolTip = tooltip;
     item.Tag = tag;
     item.BorderColor = bordercolor;
     item.FormModel = formmodel;
     item.BackImage = backimg;
     item.TextFont = fnt;
     AddFlowChartItem(item);
 }
예제 #22
0
 /// <summary>
 /// 根据名称删除节点
 /// </summary>
 /// <param name="name">节点名称</param>
 public void DeleteItem(string name)
 {
     FlowChartItem di = _FlowChartItem.FirstOrDefault(o => o.Name.Equals(name));
     if (di != null)
     {
         _FlowChartItem.Remove(di);
         if (di.Name.Equals(_CurrentItemName))
         {
             _CurrentItemName = "";
             _CurrentItem = null;
         }
     }
     DrawItems();
 }
예제 #23
0
        private void BringItemToFront(FlowChartItem item)
        {
            int max = 0;
            foreach (var obj in _FlowChartItem)
            {
                if (obj.Level > max)
                {
                    max = obj.Level;
                }
            }
            item.Level = max + 1;

            if (max > 1000)
            {
                int n = 0;
                List<FlowChartItem> list = _FlowChartItem.OrderBy(obj => obj.Level).ToList();
                foreach (var obj in list)
                {
                    obj.Level = n++;
                }
            }
            DrawItems();
        }
예제 #24
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="rect">节点区域</param>
 public void AddFlowChartItem(Rectangle rect)
 {
     FlowChartItem item = new FlowChartItem();
     item.Name = LangCenter.Instance.GetControlLangInfo("SunriseFlowChart", "NewChart") + (_FlowChartItem.Count + 1).ToString();
     item.Rect = rect;
     AddFlowChartItem(item);
 }
예제 #25
0
        private void SunriseFlowChart_MouseDown(object sender, MouseEventArgs e)
        {
            //if (e.Button == MouseButtons.Left)
            //{
            string oldName = _CurrentItemName;
            _CurrentItem = GetPointItemName(e.X, e.Y);
            _CurrentLine = GetPointLineName(e.X, e.Y);
            if (_CurrentItem != null)
            {
                IsOnClickEventHander = true;
                _CurrentItemName = _CurrentItem.Name;
                BringItemToFront(_CurrentItem);
                _ItemX = e.X;
                _ItemY = e.Y;
            }
            else
            {
                _CurrentItemName = "";
            }

            if (!oldName.Equals(_CurrentItemName))
            {
                DrawItems();
            }
            //}
            if (e.Button == MouseButtons.Right)
            {
                if (_CurrentItem != null && IsDesignMode)
                {
                    cmsMenu.Show(this, e.X, e.Y);
                }
                if (_CurrentLine != null && IsDesignMode)
                {
                    cmsLine.Show(this, e.X, e.Y);
                }
            }
        }
예제 #26
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="name">节点名称</param>
 /// <param name="rect">节点区域</param>
 public void AddFlowChartItem(string name, Rectangle rect)
 {
     FlowChartItem item = new FlowChartItem();
     item.Name = name;
     item.Rect = rect;
     AddFlowChartItem(item);
 }
예제 #27
0
 /// <summary>
 /// 删除所有节点
 /// </summary>
 public void DeleteItem()
 {
     for (int i = 0; i < _FlowChartItem.Count; i++)
     {
         FlowChartItem di = _FlowChartItem.FirstOrDefault(o => o.Name.Equals(_FlowChartItem[i].Name));
         if (di != null)
         {
             _FlowChartItem.Remove(di);
             if (di.Name.Equals(_CurrentItemName))
             {
                 _CurrentItemName = "";
                 _CurrentItem = null;
             }
         }
         DrawItems();
     }
     if (_FlowChartItem.Count > 0)
     {
         DeleteItem();
     }
 }
예제 #28
0
        private void SunriseFlowChart_MouseMove(object sender, MouseEventArgs e)
        {
            IsOnClickEventHander = false;

            if (e.Button == MouseButtons.None)
            {
                FlowChartItem overItem = GetMouseOverItemRect(e.X, e.Y);
                FlowChartLine overLine = GetMouseOverLineRect(e.X, e.Y);

                if (overItem != _OnMouseOverItem && _OnMouseOverItem != null)
                {
                    //if (OnItemMouseLeave != null)
                    //{
                    //    OnItemMouseLeave(_OnMouseOverItem.Name);
                    //}
                    //_OnMouseOverItem = null;

                }
                if (overItem != null && overItem != _OnMouseOverItem)
                {
                    if (ShowTipType != FlowChartShowTipType.NoTip)
                    {
                        if (ShowTipType == FlowChartShowTipType.ShowTip && overItem.ToolTip != "")
                        {
                            tipMsg.Rounded = true;
                            tipMsg.ShowBeak = true;
                            tipMsg.ShowHint(overItem.ToolTip, DevExpress.Utils.ToolTipLocation.TopRight, Cursor.Position);
                            tipMsg.Active = true;
                        }
                        else if (ShowTipType == FlowChartShowTipType.ShowNameIsTipNull)
                        {
                            tipMsg.Rounded = true;
                            tipMsg.ShowBeak = true;
                            tipMsg.ShowHint(overItem.ToolTip == "" ? overItem.Name : overItem.ToolTip, DevExpress.Utils.ToolTipLocation.TopRight, Cursor.Position);
                            tipMsg.Active = true;
                        }

                    }
                    //_OnMouseOverItem = overItem;
                    //if (ShowTip != null)
                    //{
                    //    ShowTip(overItem.Name, overItem.ToolTip, new Point(e.X, e.Y));
                    //}
                }
                else
                {
                    tipMsg.Active = false;
                }

                if (overLine != _OnMouseOverLine && _OnMouseOverLine != null)
                {
                    _OnMouseOverLine = null;
                }
                if (overLine != null && overLine != _OnMouseOverLine)
                {
                    _OnMouseOverLine = overLine;
                }

                _DragSide = "";
                if (overItem != null)
                {
                    Cursor = Cursors.Hand;
                }
                else
                {
                    Cursor = Cursors.Default;
                }

                if (_CurrentItem != null)
                {
                    if (e.X - _CurrentItem.Rect.Left >= 0 && e.X - _CurrentItem.Rect.Left < 4)
                    {
                        _DragSide = "left";
                        Cursor = Cursors.VSplit;
                    }
                    else if (_CurrentItem.Rect.Right - e.X >= 0 && _CurrentItem.Rect.Right - e.X < 4)
                    {
                        _DragSide = "right";
                        Cursor = Cursors.VSplit;
                    }
                    else if (e.Y - _CurrentItem.Rect.Top >= 0 && e.Y - _CurrentItem.Rect.Top < 4)
                    {
                        _DragSide = "top";
                        Cursor = Cursors.HSplit;
                    }
                    else if (_CurrentItem.Rect.Bottom - e.Y >= 0 && _CurrentItem.Rect.Bottom - e.Y < 4)
                    {
                        _DragSide = "bottom";
                        Cursor = Cursors.HSplit;
                    }
                    else
                    {
                        //_DragSide = "";
                        //Cursor = Cursors.Hand;
                    }
                }
                else
                {
                    //_DragSide = "";
                    //Cursor = Cursors.Default;
                }
                if (_CurrentLine != null && IsDesignMode)
                {
                    if (e.X - _CurrentLine.LineHead.X >= 0 && e.X - _CurrentLine.LineHead.X < 4)
                    {
                        _DragLine = "head";
                        Cursor = Cursors.SizeWE;
                    }
                    else if (_CurrentLine.LineFoot.X - e.X >= 0 && _CurrentLine.LineFoot.X - e.X < 4)
                    {
                        _DragLine = "foot";
                        Cursor = Cursors.SizeWE;
                    }
                    else if (_CurrentLine.LineHead.Y - e.Y >= 0 && _CurrentLine.LineHead.Y - e.Y < 4)
                    {
                        _DragLine = "head";
                        Cursor = Cursors.SizeWE;
                    }
                    else if (_CurrentLine.LineFoot.Y - e.Y >= 0 && _CurrentLine.LineFoot.Y - e.Y < 4)
                    {
                        _DragLine = "foot";
                        Cursor = Cursors.SizeWE;
                    }
                    else
                    {
                        //_DragLine = "";
                        //Cursor = Cursors.Default;
                    }
                }
                else
                {
                    //_DragLine = "";
                    //Cursor = Cursors.Default;
                }
            }
            else
            {
                if (_OnMouseOverItem != null)
                {
                    //if (OnItemMouseLeave != null)
                    //{
                    //    OnItemMouseLeave(_mouseOverItem.Name);
                    //}
                    _OnMouseOverItem = null;
                }
                if (_OnMouseOverLine != null)
                {
                    _OnMouseOverLine = null;
                }
            }

            if (e.Button == MouseButtons.Left && IsDesignMode)
            {
                if (_CurrentItem != null)
                {
                    if (_DragSide.Equals("left"))
                    {
                        if (e.X + _ItemMinWidth <= _CurrentItem.Rect.Right)
                        {
                            int right = _CurrentItem.Rect.Right;
                            _CurrentItem.Rect.X = e.X;
                            _CurrentItem.Rect.Width = right - e.X;
                            DrawItems();
                        }
                    }
                    if (_DragSide.Equals("right"))
                    {
                        if (e.X - _CurrentItem.Rect.Left >= _ItemMinWidth)
                        {
                            _CurrentItem.Rect.Width = e.X - _CurrentItem.Rect.Left;
                            DrawItems();
                        }
                    }
                    if (_DragSide.Equals("top"))
                    {
                        if (e.Y + _ItemMinHeight <= _CurrentItem.Rect.Bottom)
                        {
                            int bottom = _CurrentItem.Rect.Bottom;
                            _CurrentItem.Rect.Y = e.Y;
                            _CurrentItem.Rect.Height = bottom - e.Y;
                            DrawItems();
                        }
                    }
                    if (_DragSide.Equals("bottom"))
                    {
                        if (e.Y - _CurrentItem.Rect.Top >= _ItemMinHeight)
                        {
                            _CurrentItem.Rect.Height = e.Y - _CurrentItem.Rect.Top;
                            DrawItems();
                        }
                    }

                    if (_DragSide.Equals(""))
                    {
                        _CurrentItem.Rect.X += e.X - _ItemX;
                        _CurrentItem.Rect.Y += e.Y - _ItemY;
                        _ItemX = e.X;
                        _ItemY = e.Y;
                        DrawItems();
                    }
                }
                if (_CurrentLine != null)
                {
                    if (_DragLine.Equals("head"))
                    {
                        _CurrentLine.LineHead.X = e.X;
                        _CurrentLine.LineHead.Y = e.Y;
                        DrawItems();
                    }
                    if (_DragLine.Equals("foot"))
                    {
                        _CurrentLine.LineFoot.X = e.X;
                        _CurrentLine.LineFoot.Y = e.Y;
                        DrawItems();
                    }
                    if (_DragLine.Equals(""))
                    {
                        //_CurrentItem.Rect.X += e.X - _ItemX;
                        //_CurrentItem.Rect.Y += e.Y - _ItemY;
                        //_ItemX = e.X;
                        //_ItemY = e.Y;
                        //DrawItems();
                    }
                }
            }
        }
예제 #29
0
        ///// <summary>
        ///// 显示提示事件代理
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="tooltip"></param>
        //public delegate void FlowChartItemShowTipEventHandler(string name,string tooltip,Point p);


        ///// <summary>
        ///// 显示提示
        ///// </summary>
        //public event FlowChartItemShowTipEventHandler ShowTip;


        //public delegate void FlowChartItemMouseLeaveHandler(string name);


        //public event FlowChartItemMouseLeaveHandler OnItemMouseLeave;


        #endregion


        #region 方法处理


        /// <summary>
        /// 画节点
        /// </summary>
        /// <param name="item">FlowChartItem节点对象</param>
        private void AddFlowChartItem(FlowChartItem item)
        {
            _FlowChartItem.Add(item);
            BringItemToFront(item);
        }
예제 #30
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="item">FlowChartItem节点对象</param>
 private void AddFlowChartItem(FlowChartItem item)
 {
     _FlowChartItem.Add(item);
     BringItemToFront(item);
 }
예제 #31
0
        private void BWSFlowChart_MouseMove(object sender, MouseEventArgs e)
        {
            IsOnClickEventHander = false;


            if (e.Button == MouseButtons.None)
            {
                FlowChartItem overItem = GetMouseOverItemRect(e.X, e.Y);
                FlowChartLine overLine = GetMouseOverLineRect(e.X, e.Y);

                if (overItem != _OnMouseOverItem && _OnMouseOverItem != null)
                {
                    //if (OnItemMouseLeave != null)
                    //{
                    //    OnItemMouseLeave(_OnMouseOverItem.Name);
                    //}
                    //_OnMouseOverItem = null;
                }
                if (overItem != null && overItem != _OnMouseOverItem)
                {
                    if (ShowTipType != FlowChartShowTipType.NoTip)
                    {
                        if (ShowTipType == FlowChartShowTipType.ShowTip && overItem.ToolTip != "")
                        {
                            tipMsg.Rounded  = true;
                            tipMsg.ShowBeak = true;
                            tipMsg.ShowHint(overItem.ToolTip, DevExpress.Utils.ToolTipLocation.TopRight, Cursor.Position);
                            tipMsg.Active = true;
                        }
                        else if (ShowTipType == FlowChartShowTipType.ShowNameIsTipNull)
                        {
                            tipMsg.Rounded  = true;
                            tipMsg.ShowBeak = true;
                            tipMsg.ShowHint(overItem.ToolTip == "" ? overItem.Name : overItem.ToolTip, DevExpress.Utils.ToolTipLocation.TopRight, Cursor.Position);
                            tipMsg.Active = true;
                        }
                    }
                    //_OnMouseOverItem = overItem;
                    //if (ShowTip != null)
                    //{
                    //    ShowTip(overItem.Name, overItem.ToolTip, new Point(e.X, e.Y));
                    //}
                }
                else
                {
                    tipMsg.Active = false;
                }


                if (overLine != _OnMouseOverLine && _OnMouseOverLine != null)
                {
                    _OnMouseOverLine = null;
                }
                if (overLine != null && overLine != _OnMouseOverLine)
                {
                    _OnMouseOverLine = overLine;
                }



                _DragSide = "";
                if (overItem != null)
                {
                    Cursor = Cursors.Hand;
                }
                else
                {
                    Cursor = Cursors.Default;
                }


                if (_CurrentItem != null)
                {
                    if (e.X - _CurrentItem.Rect.Left >= 0 && e.X - _CurrentItem.Rect.Left < 4)
                    {
                        _DragSide = "left";
                        Cursor    = Cursors.VSplit;
                    }
                    else if (_CurrentItem.Rect.Right - e.X >= 0 && _CurrentItem.Rect.Right - e.X < 4)
                    {
                        _DragSide = "right";
                        Cursor    = Cursors.VSplit;
                    }
                    else if (e.Y - _CurrentItem.Rect.Top >= 0 && e.Y - _CurrentItem.Rect.Top < 4)
                    {
                        _DragSide = "top";
                        Cursor    = Cursors.HSplit;
                    }
                    else if (_CurrentItem.Rect.Bottom - e.Y >= 0 && _CurrentItem.Rect.Bottom - e.Y < 4)
                    {
                        _DragSide = "bottom";
                        Cursor    = Cursors.HSplit;
                    }
                    else
                    {
                        //_DragSide = "";
                        //Cursor = Cursors.Hand;
                    }
                }
                else
                {
                    //_DragSide = "";
                    //Cursor = Cursors.Default;
                }
                if (_CurrentLine != null && IsDesignMode)
                {
                    if (e.X - _CurrentLine.LineHead.X >= 0 && e.X - _CurrentLine.LineHead.X < 4)
                    {
                        _DragLine = "head";
                        Cursor    = Cursors.SizeWE;
                    }
                    else if (_CurrentLine.LineFoot.X - e.X >= 0 && _CurrentLine.LineFoot.X - e.X < 4)
                    {
                        _DragLine = "foot";
                        Cursor    = Cursors.SizeWE;
                    }
                    else if (_CurrentLine.LineHead.Y - e.Y >= 0 && _CurrentLine.LineHead.Y - e.Y < 4)
                    {
                        _DragLine = "head";
                        Cursor    = Cursors.SizeWE;
                    }
                    else if (_CurrentLine.LineFoot.Y - e.Y >= 0 && _CurrentLine.LineFoot.Y - e.Y < 4)
                    {
                        _DragLine = "foot";
                        Cursor    = Cursors.SizeWE;
                    }
                    else
                    {
                        //_DragLine = "";
                        //Cursor = Cursors.Default;
                    }
                }
                else
                {
                    //_DragLine = "";
                    //Cursor = Cursors.Default;
                }
            }
            else
            {
                if (_OnMouseOverItem != null)
                {
                    //if (OnItemMouseLeave != null)
                    //{
                    //    OnItemMouseLeave(_mouseOverItem.Name);
                    //}
                    _OnMouseOverItem = null;
                }
                if (_OnMouseOverLine != null)
                {
                    _OnMouseOverLine = null;
                }
            }


            if (e.Button == MouseButtons.Left && IsDesignMode)
            {
                if (_CurrentItem != null)
                {
                    if (_DragSide.Equals("left"))
                    {
                        if (e.X + _ItemMinWidth <= _CurrentItem.Rect.Right)
                        {
                            int right = _CurrentItem.Rect.Right;
                            _CurrentItem.Rect.X     = e.X;
                            _CurrentItem.Rect.Width = right - e.X;
                            DrawItems();
                        }
                    }
                    if (_DragSide.Equals("right"))
                    {
                        if (e.X - _CurrentItem.Rect.Left >= _ItemMinWidth)
                        {
                            _CurrentItem.Rect.Width = e.X - _CurrentItem.Rect.Left;
                            DrawItems();
                        }
                    }
                    if (_DragSide.Equals("top"))
                    {
                        if (e.Y + _ItemMinHeight <= _CurrentItem.Rect.Bottom)
                        {
                            int bottom = _CurrentItem.Rect.Bottom;
                            _CurrentItem.Rect.Y      = e.Y;
                            _CurrentItem.Rect.Height = bottom - e.Y;
                            DrawItems();
                        }
                    }
                    if (_DragSide.Equals("bottom"))
                    {
                        if (e.Y - _CurrentItem.Rect.Top >= _ItemMinHeight)
                        {
                            _CurrentItem.Rect.Height = e.Y - _CurrentItem.Rect.Top;
                            DrawItems();
                        }
                    }


                    if (_DragSide.Equals(""))
                    {
                        _CurrentItem.Rect.X += e.X - _ItemX;
                        _CurrentItem.Rect.Y += e.Y - _ItemY;
                        _ItemX = e.X;
                        _ItemY = e.Y;
                        DrawItems();
                    }
                }
                if (_CurrentLine != null)
                {
                    if (_DragLine.Equals("head"))
                    {
                        _CurrentLine.LineHead.X = e.X;
                        _CurrentLine.LineHead.Y = e.Y;
                        DrawItems();
                    }
                    if (_DragLine.Equals("foot"))
                    {
                        _CurrentLine.LineFoot.X = e.X;
                        _CurrentLine.LineFoot.Y = e.Y;
                        DrawItems();
                    }
                    if (_DragLine.Equals(""))
                    {
                        //_CurrentItem.Rect.X += e.X - _ItemX;
                        //_CurrentItem.Rect.Y += e.Y - _ItemY;
                        //_ItemX = e.X;
                        //_ItemY = e.Y;
                        //DrawItems();
                    }
                }
            }
        }
예제 #32
0
 /// <summary>
 /// 画节点
 /// </summary>
 /// <param name="name">节点名称</param>
 public void AddFlowChartItem(string name)
 {
     FlowChartItem item = new FlowChartItem();
     item.Name = name;
     AddFlowChartItem(item);
 }