Exemplo n.º 1
0
 public VisualLink(VisualLink l)
 {
     this.v1 = l.v1;
     this.v2 = l.v2;
     UpdateLink();
 }
Exemplo n.º 2
0
        private void VisualVertex_MouseUp(object sender, MouseEventArgs e)
        {
            Point p = new Point(this.Left + e.X, this.Top + e.Y);
            bool duplicate = false;
            int m;
            isDragging = false;
            try
            {
                m = Convert.ToInt32(GlobalVisual.text.Text);
            }
            catch
            {
                m = 1;
            }
            if (GlobalVisual.isConnecting)
            {
                foreach (VisualVertex v in GlobalVisual.Vertexes)
                {
                    Rectangle r = new Rectangle(v.Left, v.Top, v.Width, v.Height);
                    if (r.Contains(p) && !this.Equals(v))
                    {
                        foreach (VisualLink vl in GlobalVisual.Links)
                        {
                            if ((this.Equals(vl.v1) || this.Equals(vl.v2)) &&
                                (v.Equals(vl.v1) || v.Equals(vl.v2)))
                            {
                                duplicate = true;
                                if (m <= 0)
                                    GlobalVisual.Links.Remove(vl);
                                else
                                    vl.Weight = m;
                                break;
                            }
                        }
                        if (!duplicate)
                        {
                            VisualLink l = new VisualLink(this, v);
                            l.Weight = m;
                            if (l.Weight > 0)
                            {
                                GlobalVisual.Links.Add(l);
                            }
                        }
                        break;
                    }
                }
            }
            //else
            //	;
            if(this.C != Color.Firebrick && this.C != Color.ForestGreen)
                this.C = Color.White;
            GlobalVisual.isConnecting = false;
            GlobalVisual.isCreateLink = false;
            GlobalVisual.isSelect1 = false;
            GlobalVisual.isSelect2 = false;
            GlobalVisual.button3.BackColor = Color.SteelBlue;
            GlobalVisual.button4.BackColor = Color.SteelBlue;
            GlobalVisual.BuildMatrix();

            Invalidate();
            Parent.Invalidate();
        }
Exemplo n.º 3
0
        private void VisualVertex_MouseUp(object sender, MouseEventArgs e)
        {
            Point p         = new Point(this.Left + e.X, this.Top + e.Y);
            bool  duplicate = false;
            int   m;

            isDragging = false;
            try
            {
                m = Convert.ToInt32(GlobalVisual.text.Text);
            }
            catch
            {
                m = 1;
            }
            if (GlobalVisual.isConnecting)
            {
                foreach (VisualVertex v in GlobalVisual.Vertexes)
                {
                    Rectangle r = new Rectangle(v.Left, v.Top, v.Width, v.Height);
                    if (r.Contains(p) && !this.Equals(v))
                    {
                        foreach (VisualLink vl in GlobalVisual.Links)
                        {
                            if ((this.Equals(vl.v1) || this.Equals(vl.v2)) &&
                                (v.Equals(vl.v1) || v.Equals(vl.v2)))
                            {
                                duplicate = true;
                                if (m <= 0)
                                {
                                    GlobalVisual.Links.Remove(vl);
                                }
                                else
                                {
                                    vl.Weight = m;
                                }
                                break;
                            }
                        }
                        if (!duplicate)
                        {
                            VisualLink l = new VisualLink(this, v);
                            l.Weight = m;
                            if (l.Weight > 0)
                            {
                                GlobalVisual.Links.Add(l);
                            }
                        }
                        break;
                    }
                }
            }
            //else
            //	;
            if (this.C != Color.Firebrick && this.C != Color.ForestGreen)
            {
                this.C = Color.White;
            }
            GlobalVisual.isConnecting      = false;
            GlobalVisual.isCreateLink      = false;
            GlobalVisual.isSelect1         = false;
            GlobalVisual.isSelect2         = false;
            GlobalVisual.button3.BackColor = Color.SteelBlue;
            GlobalVisual.button4.BackColor = Color.SteelBlue;
            GlobalVisual.BuildMatrix();

            Invalidate();
            Parent.Invalidate();
        }
Exemplo n.º 4
0
 public VisualLink(VisualLink l)
 {
     this.v1 = l.v1;
     this.v2 = l.v2;
     UpdateLink();
 }