private void pbPovezivanje_Click(object sender, EventArgs e) { if (selektovana != null && selektovana2 != null) { UnosRazdaljine udaljenost = new UnosRazdaljine(); if (udaljenost.ShowDialog() == DialogResult.OK) { Rastojanje r = new Rastojanje(); r.razd = udaljenost.razdaljina; r.g1 = selektovana; r.g2 = selektovana2; Lista.Instanca().listaRastojanja.Add(r); // Model.MemorisiDatoteku(); gradoviPanel1.Refresh(); } } else { MessageBox.Show("Dva grada moraju biti selektovana da bi se mogla povezati!"); } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { Lista.Instanca().LOAD(); gradoviPanel1.SuspendLayout(); for (int i = 0; i < Lista.listaDat.Count; i++) { Dat d1 = Lista.listaDat[i]; PictureBox pb = new PictureBox(); pb.AllowDrop = false; pb.Location = d1.lokacija; pb.Size = d1.velicina; pb.Image = d1.slk; pb.Tag = d1.tag; // pb.Name = "grad " + chA.ToString(); //MessageBox.Show(pb.Name); pb.SizeMode = PictureBoxSizeMode.AutoSize; pb.MouseClick += new MouseEventHandler(gradoviPanel1_MouseClick); pb.MouseDown += new MouseEventHandler(pb_MouseDown); pb.MouseMove += new MouseEventHandler(pb_MouseMove); // a++; //i++; //MessageBox.Show(pb.Name); // listaGradova.Add(pb); PictureBox pb2 = new PictureBox(); pb2.AllowDrop = false; pb2.Location = d1.lokacija2; pb2.Size = d1.velicina2; pb2.Image = d1.slk2; pb2.Tag = d1.tag2; // pb.Name = "grad " + chA.ToString(); //MessageBox.Show(pb.Name); pb2.SizeMode = PictureBoxSizeMode.AutoSize; pb2.MouseClick += new MouseEventHandler(gradoviPanel1_MouseClick); pb2.MouseDown += new MouseEventHandler(pb_MouseDown); pb2.MouseMove += new MouseEventHandler(pb_MouseMove); // a++; //i++; //MessageBox.Show(pb.Name); gradoviPanel1.Controls.Add(pb); gradoviPanel1.Controls.Add(pb2); // listaGradova.Add(pb); Rastojanje r = new Rastojanje(); r.razd = d1.razdaljina; r.g1 = pb; r.g2 = pb2; // Model.MemorisiDatoteku(); // gradoviPanel1.Refresh(); Lista.Instanca().listaRastojanja.Add(r); } gradoviPanel1.ResumeLayout(false); gradoviPanel1.Refresh(); }