Example #1
0
        /// <summary>
        /// 画线
        /// </summary>
        /// <param name="name">连接线对象名称</param>
        public void AddFlowChartLine(string name)
        {
            FlowChartLine line = new FlowChartLine();

            line.LineName = name;
            AddFlowChartLine(line);
        }
Example #2
0
        /// <summary>
        /// 画线
        /// </summary>
        /// <param name="name">连接线对象名称</param>
        /// <param name="p1">连接线起点</param>
        /// <param name="p2">连接线终点</param>
        public void AddFlowChartLine(string name, Point p1, Point p2)
        {
            FlowChartLine line = new FlowChartLine();

            line.LineName = name;
            line.LineHead = p1;
            line.LineFoot = p2;
            AddFlowChartLine(line);
        }
Example #3
0
        /// <summary>
        /// 画线
        /// </summary>
        /// <param name="p1">连接线起点</param>
        /// <param name="p2">连接线终点</param>
        public void AddFlowChartLine(Point p1, Point p2)
        {
            FlowChartLine line = new FlowChartLine();

            line.LineName = "Line" + (_FlowChartLine.Count + 1).ToString();
            line.LineHead = p1;
            line.LineFoot = p2;
            AddFlowChartLine(line);
        }
Example #4
0
        /// <summary>
        /// 画线
        /// </summary>
        /// <param name="p1">连接线起点</param>
        /// <param name="p2">连接线终点</param>
        /// <param name="linecolor">线颜色</param>
        /// <param name="linewidth">线粗细</param>
        public void AddFlowChartLine(Point p1, Point p2, Color linecolor, int linewidth)
        {
            FlowChartLine line = new FlowChartLine();

            line.LineName  = "Line" + (_FlowChartLine.Count + 1).ToString();
            line.LineHead  = p1;
            line.LineFoot  = p2;
            line.LineColor = linecolor;
            line.LineWidth = linewidth;
            AddFlowChartLine(line);
        }
Example #5
0
 private FlowChartLine GetMouseOverLineRect(int x, int y)
 {
     for (int i = _FlowChartLine.Count - 1; i >= 0; i--)
     {
         FlowChartLine obj = _FlowChartLine[i];
         if (CheckPointOnLine(new Point(x, y), obj.LineHead, obj.LineFoot))
         {
             return(obj);
         }
     }
     return(null);
 }
Example #6
0
        /// <summary>
        /// 根据名称删除线
        /// </summary>
        /// <param name="name">线名称</param>
        public void DeleteLine(string name)
        {
            FlowChartLine di = _FlowChartLine.FirstOrDefault(o => o.LineName.Equals(name));

            if (di != null)
            {
                _FlowChartLine.Remove(di);
                if (di.LineName.Equals(_CurrentLineName))
                {
                    _CurrentLineName = "";
                    _CurrentLine     = null;
                }
            }
            DrawItems();
        }
Example #7
0
 /// <summary>
 /// 删除全部线
 /// </summary>
 public void DeleteLine()
 {
     for (int i = 0; i < _FlowChartLine.Count; i++)
     {
         FlowChartLine di = _FlowChartLine.FirstOrDefault(o => o.LineName.Equals(_FlowChartLine[i].LineName));
         if (di != null)
         {
             _FlowChartLine.Remove(di);
             if (di.LineName.Equals(_CurrentLineName))
             {
                 _CurrentLineName = "";
                 _CurrentLine     = null;
             }
         }
         DrawItems();
     }
     if (_FlowChartLine.Count > 0)
     {
         DeleteLine();
     }
 }
Example #8
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);
                }
            }
        }
Example #9
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();
                    }
                }
            }
        }
Example #10
0
 /// <summary>
 /// 画线
 /// </summary>
 /// <param name="name">连接线对象名称</param>
 /// <param name="p1">连接线起点</param>
 /// <param name="p2">连接线终点</param>
 public void AddFlowChartLine(string name, Point p1, Point p2)
 {
     FlowChartLine line = new FlowChartLine();
     line.LineName = name;
     line.LineHead = p1;
     line.LineFoot = p2;
     AddFlowChartLine(line);
 }
Example #11
0
 /// <summary>
 /// 画线
 /// </summary>
 /// <param name="p1">连接线起点</param>
 /// <param name="p2">连接线终点</param>
 public void AddFlowChartLine(Point p1, Point p2)
 {
     FlowChartLine line = new FlowChartLine();
     line.LineName = "Line" + (_FlowChartLine.Count + 1).ToString();
     line.LineHead = p1;
     line.LineFoot = p2;
     AddFlowChartLine(line);
 }
Example #12
0
 /// <summary>
 /// 画线
 /// </summary>
 /// <param name="line">FlowChartLine对象</param>
 public void AddFlowChartLine(FlowChartLine line)
 {
     _FlowChartLine.Add(line);
     DrawItems();
 }
Example #13
0
 /// <summary>
 /// 画线
 /// </summary>
 /// <param name="name">连接线对象名称</param>
 public void AddFlowChartLine(string name)
 {
     FlowChartLine line = new FlowChartLine();
     line.LineName = name;
     AddFlowChartLine(line);
 }
Example #14
0
 /// <summary>
 /// 画线
 /// </summary>
 /// <param name="p1">连接线起点</param>
 /// <param name="p2">连接线终点</param>
 /// <param name="linecolor">线颜色</param>
 /// <param name="linewidth">线粗细</param>
 public void AddFlowChartLine(Point p1, Point p2, Color linecolor, int linewidth)
 {
     FlowChartLine line = new FlowChartLine();
     line.LineName = "Line" + (_FlowChartLine.Count + 1).ToString();
     line.LineHead = p1;
     line.LineFoot = p2;
     line.LineColor = linecolor;
     line.LineWidth = linewidth;
     AddFlowChartLine(line);
 }
Example #15
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);
                }
            }
        }
Example #16
0
 /// <summary>
 /// 删除全部线
 /// </summary>
 public void DeleteLine()
 {
     for (int i = 0; i < _FlowChartLine.Count; i++)
     {
         FlowChartLine di = _FlowChartLine.FirstOrDefault(o => o.LineName.Equals(_FlowChartLine[i].LineName));
         if (di != null)
         {
             _FlowChartLine.Remove(di);
             if (di.LineName.Equals(_CurrentLineName))
             {
                 _CurrentLineName = "";
                 _CurrentLine = null;
             }
         }
         DrawItems();
     }
     if (_FlowChartLine.Count > 0)
     {
         DeleteLine();
     }
 }
Example #17
0
 /// <summary>
 /// 根据名称删除线
 /// </summary>
 /// <param name="name">线名称</param>
 public void DeleteLine(string name)
 {
     FlowChartLine di = _FlowChartLine.FirstOrDefault(o => o.LineName.Equals(name));
     if (di != null)
     {
         _FlowChartLine.Remove(di);
         if (di.LineName.Equals(_CurrentLineName))
         {
             _CurrentLineName = "";
             _CurrentLine = null;
         }
     }
     DrawItems();
 }
Example #18
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();
                    }
                }
            }
        }
Example #19
0
 /// <summary>
 /// 画线
 /// </summary>
 /// <param name="line">FlowChartLine对象</param>
 public void AddFlowChartLine(FlowChartLine line)
 {
     _FlowChartLine.Add(line);
     DrawItems();
 }