Exemple #1
0
 private void button1_Click(object sender, EventArgs e) //dodelat` proverky na debila
 {
     if (!(textBox1.Text == "" && textBox2.Text == ""))
     {
         if ((Convert.ToInt32(textBox2.Text) >= vertex && textBox1.Visible == false) && ((Convert.ToInt32(textBox1.Text) >= vertex || Convert.ToInt32(textBox2.Text) >= vertex) || textBox1.Text == textBox2.Text))
         {
             msg eror = new msg("Incorrect data. Plese do it correct", 1);
             eror.textBox1.Text    = "";
             eror.textBox2.Text    = "";
             eror.textBox1.Visible = false;
             eror.textBox2.Visible = false;
             textBox2.Text         = "";
             textBox1.Text         = "";
             eror.ShowDialog();
         }
         else
         {
             Close();
         }
     }
     else
     {
         Close();
     }
 }
Exemple #2
0
        private void btAddEdge_Click(object sender, EventArgs e)
        {
            string sym = "0";
            msg    mes = new msg("What vertex to connect: ", vertex);

            mes.ShowDialog();
            if (mes.getId != -1)
            {
                int i = mes.getId, j = mes.getId_2;
                if (((Button)sender).Name == "btAddEdge")
                {
                    sym = "1";
                }
                path = path.Remove(i * (vertex * 2 + 1) + j * 2, 1).Insert(i * (vertex * 2 + 1) + j * 2, sym);
                path = path.Remove(j * (vertex * 2 + 1) + i * 2, 1).Insert(j * (vertex * 2 + 1) + i * 2, sym);
                drawGraph_CheckedChanged(null, null);
            }
        }
Exemple #3
0
        private void btRemoveVert_Click(object sender, EventArgs e)
        {
            msg mes = new msg("Enter number vertex to remove: ", vertex);

            mes.textBox1.Visible = false;
            mes.ShowDialog();
            path = path.Remove(vertex * 2 * mes.getId + 1, vertex * 2 + 1);
            for (int i = 0; i < vertex - 1; i++)
            {
                if (mes.getId == 0)
                {
                    path = path.Remove(mes.getId * 2 + i * (vertex - 1) * 2 + 1 * i, 2);
                }
                else
                {
                    path = path.Remove(mes.getId * 2 - 1 + i * (vertex - 1) * 2 + 1 * i, 2);
                }
            }
            vertex--;
            drawGraph_CheckedChanged(null, null);
        }