Esempio n. 1
0
        private void asignaPesos(Point p)
        {
            int pmx, pmy; // PUNTO MEDIO EN X Y PUNTO MEDIO EN Y

            temp = grafo.encuentraArista(p);
            if (temp != null)
            {
                //    MessageBox.Show("Nodo Origen " + temp.origen.nombre + "\nNodo Destino " + temp.destino.nombre);
                numeric         = new NumericUpDown();
                numeric.Maximum = 10;
                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);
                Controls.Add(numeric);
            }
        }