Exemplo n.º 1
0
 private void comboNodos_TextChanged(object sender, EventArgs e)
 {
     textBoxNodos.Text = grafo.Find(delegate(NodoP r) { if (r.NOMBRE.ToString() == comboNodos.Text)
                                                        {
                                                            return(true);
                                                        }
                                                        else
                                                        {
                                                            return(false);
                                                        } }).NOMBRE.ToString();
 }
Exemplo n.º 2
0
 private void Interno_TextChanged(object sender, EventArgs e)
 {
     LabInterno.Text = grafo.Find(delegate(NodoP a) { if (a.NOMBRE.ToString() == Interno.Text)
                                                      {
                                                          return(true);
                                                      }
                                                      else
                                                      {
                                                          return(false);
                                                      } }).GradoInterno.ToString();
 }
Exemplo n.º 3
0
        private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            NodoP    des;
            Graphics au;

            au = Graphics.FromImage(bmp1);
            au.Clear(BackColor);
            switch (accion)
            {
            case 1:
                p    = pm;
                pm   = e.Location;
                band = true;
                Form1_Paint(this, null);
                band = false;
                break;

            case 2:
                nu = null;
                break;

            case 3:
                des = (NodoP)grafo.Find(delegate(NodoP a) { if (e.Location.X > a.POS.X - 15 && e.Location.X < a.POS.X + 30 && e.Location.Y > a.POS.Y - 15 && e.Location.Y < a.POS.Y + 30)
                                                            {
                                                                return(true);
                                                            }
                                                            else
                                                            {
                                                                return(false);
                                                            } });
                if (des != null && nu != null)
                {
                    if (nu.insertaRelacion(des, grafo.Aristas.Count))
                    {
                        a = new Arista(tipoarista, nu, des, "e" + grafo.Aristas.Count.ToString());
                        grafo.AgregaArista(a);
                        nu.GRADO++;
                        des.GRADO++;
                        nu.GradoExterno++;
                        des.GradoInterno++;
                    }
                    if (tipoarista == 2 && a.Destino.NOMBRE != a.Origen.NOMBRE)
                    {
                        des.insertaRelacion(nu, grafo.Aristas.Count - 1);
                        des.GradoExterno++;
                        nu.GradoInterno++;
                    }

                    grafo.pinta(au);
                    band = false;
                    nu   = null;
                }
                else
                {
                    grafo.pinta(au);
                }
                g.DrawImage(bmp1, 0, 0);
                break;

            case 4:
                nu = (NodoP)grafo.Find(delegate(NodoP a) { if (e.Location.X > a.POS.X - 15 && e.Location.X < a.POS.X + 30 && e.Location.Y > a.POS.Y - 15 && e.Location.Y < a.POS.Y + 30)
                                                           {
                                                               return(true);
                                                           }
                                                           else
                                                           {
                                                               return(false);
                                                           } });
                if (nu != null)
                {
                    grafo.RemueveNodo(nu);
                    band = true;
                    if (grafo.Count == 0)
                    {
                        nombre  = 'A';
                        gactivo = false;
                    }
                    Form1_Paint(this, null);
                    band = false;
                }
                break;

            case 7:
            case 9:
            case 8:
                SeleccionaNodos();
                break;
            }
        }