Exemple #1
0
        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            p1 = e.Location;
            if (activa)
            {
                nodoW  = grafo.BuscaNodo(p1);
                activa = false;
            }

            switch (opcion)
            {
            case 1:
                if (/*grafo.Count == 1 &&*/ grafo.numN == 1)
                {
                    grafo.numN++;
                }
                if (grafo.Count > 0)
                {
                    nodoP = new NodoP(grafo.Count - 1, p1);
                }
                else
                {
                    nodoP = new NodoP(grafo.numN - 1, p1);
                }
                grafo.Add(nodoP);
                grafo.nomb   = nodoP.nombre;
                nodoP.nombre = grafo.Count;
                band         = false;
                bandF        = true;
                if (grafo.numN == 28 && grafo.Count == 28)
                {
                    bandI        = true;
                    grafo.edoNom = true;
                }
                else
                {
                    bandI = false;
                }
                Form1_Paint(this, null);
                break;

            case 2:
            case 9:
                nodoP = grafo.BuscaNodo(p1);
                if (nodoP != null)
                {
                    band  = true;
                    bandA = true;
                }
                else
                {
                    band = false;
                }
                break;

            case 3:
                nodoP = grafo.BuscaNodo(p1);
                if (nodoP != null)
                {
                    bandA = true;
                }
                else
                {
                    band = false;
                }
                break;

            case 8:
                p1 = e.Location;


                break;
            }
        }