Example #1
0
        /// <summary>
        /// </summary>
        private void miDefine_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.Cross;
                SelectProcessForm spf = new SelectProcessForm(this.Parent);
                if (spf.ShowDialog() == DialogResult.OK)
                {
                    ProcessButton     pb = spf.SelectedButton;
                    DefineArrowButton dab;
                    if (pb.Left > this.Left)
                    {
                        Point startPoint = new Point(this.Left + this.Width, this.Top);
                        Point endPoint   = new Point(pb.Left, pb.Top + pb.Height);
                        dab = new DefineArrowButton(startPoint, endPoint);
                        //向右上方画
                        dab.Left = this.Left + this.Width;
                        dab.Top  = this.Top - (startPoint.Y - endPoint.Y);
                    }
                    else
                    {
                        Point startPoint = new Point(this.Left, this.Top);
                        Point endPoint   = new Point(pb.Left + pb.Width, pb.Top + pb.Height);
                        dab = new DefineArrowButton(startPoint, endPoint);
                        //向右上方画
                        dab.Left = endPoint.X;
                        dab.Top  = endPoint.Y;
                    }

                    this.Parent.Controls.Add(dab);
                    OutFlows.Add(dab);
                    dab.FromProcesses.Add(this);
                    dab.ToProcesses.Add(pb);
                }
                //获取目标点
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Example #2
0
        /// <summary>
        /// </summary>
        private void miJump_Click(object sender, EventArgs e)
        {
            //选择目标点
            ProcessButton     pbEnd = null;
            SelectProcessForm spf   = new SelectProcessForm(this.Parent);

            if (spf.ShowDialog() == DialogResult.OK)
            {
                pbEnd = spf.SelectedButton;
                int length = 0;
                if (pbEnd.Left > this.Left)
                {
                    length = Math.Abs(pbEnd.Left - this.Left - DrawUtility.a);
                }
                else
                {
                    length = Math.Abs(this.Left - pbEnd.Left - DrawUtility.a);
                }

                bool            isBack = pbEnd.Left < this.Left;
                JumpArrowButton jab    = new JumpArrowButton(isBack, length);
                DrawUtility.DrawJumpArrow(jab, null, length, isBack);
                if (pbEnd.Left > this.Left)
                {
                    jab.Left = this.Left + this.Width / 2 - DrawUtility.a;
                    jab.Top  = this.Top - 12 * DrawUtility.a;
                }
                else
                {
                    jab.Left = pbEnd.Left + pbEnd.Width / 2 - DrawUtility.a;
                    jab.Top  = this.Top - 17 * DrawUtility.a;
                }
                this.Parent.Controls.Add(jab);
                OutFlows.Add(jab);
                jab.FromProcesses.Add(this);
                jab.ToProcesses.Add(pbEnd);
            }
        }