private void stazioneClick(object sender, MouseEventArgs e)
        {
            PictureBox pic = (PictureBox)sender;
            Stazione   sel = staz[Convert.ToInt32(pic.Tag)];

            if (createLink)
            {
                if (uno == null)
                {
                    uno = sel;
                }
                else
                {
                    Graphics gs = panel1.CreateGraphics();
                    Pen      pn = new Pen(Color.Cyan, 3);
                    gs.DrawLine(pn, uno.x, uno.y, sel.x, sel.y);
                    uno = null;
                }
            }
            else if (!createStation)
            {
                VisualStazione vs = new VisualStazione(sel);
                vs.ShowDialog();
            }
        }
 private void button2_Click(object sender, EventArgs e)
 {
     if (createLink)
     {
         button2.BackColor = Color.White;
         uno = null;
     }
     else
     {
         button2.BackColor = Color.DarkGray;
         button1.BackColor = Color.White;
         createStation     = false;
     }
     createLink = !createLink;
 }
Beispiel #3
0
 public VisualStazione(Stazione s)
 {
     InitializeComponent();
     labelX.Text += s.x;
     labelY.Text += s.y;
 }