예제 #1
0
        private void asignaPesos(Point p) // pesos
        {
            int pmx, pmy;                 // PUNTO MEDIO EN X Y PUNTO MEDIO EN Y

            temp = grafo.encuentraArista(p);
            if (grafo.tipo == 2)
            {
                temp2 = grafo.encuentraSegundaArista(p);
            }
            if (temp != null)
            {
                // MessageBox.Show("Nodo Origen " + temp.origen.nombre + "\nNodo Destino " + temp.destino.nombre);
                numeric         = new NumericUpDown();
                numeric.Maximum = 100;
                numeric.Minimum = 1;


                if (temp.peso != 0)
                {
                    numeric.Value = temp.peso;
                }

                pmx                   = (temp.origen.centro.X + temp.destino.centro.X) / 2;
                pmy                   = (temp.origen.centro.Y + temp.destino.centro.Y) / 2;
                pmx                  += 5;
                pmy                  += 5;
                numeric.Name          = "numeric";
                numeric.Width         = 40;
                numeric.Location      = new Point(pmx, pmy);
                numeric.ValueChanged += Numeric_ValueChanged;
                temp.peso             = Convert.ToInt32(numeric.Value);
                if (grafo.tipo == 2)
                {
                    temp2.peso = Convert.ToInt32(numeric.Value); //
                }
                Controls.Add(numeric);                           //
            }
        }