Пример #1
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     try
     {
         Vertex vertex = new Vertex(txt_v.Text);
         vertex.position = new Point(Convert.ToInt32(txt_x.Text), Convert.ToInt32(txt_y.Text));
         adjGraph.AddVertex(vertex);
         txt_matrix.Text = adjGraph.GenerateAdjacencyMatrix();
         txt_info.Text   = adjGraph.GetInfo();
         txt_x.Text      = txt_y.Text = txt_v.Text = "";
         Redraw();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         SquareMatrix matrix = new SquareMatrix(txt_matrix.Lines, '\t');
         adjGraph = new SimpleGraph(matrix);
         adjGraph.autoPosition     = rdAuto.Checked;
         adjGraph.circularPosition = rdCircular.Checked;
         txt_info.Text             = adjGraph.GetInfo();
         Redraw();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }