예제 #1
0
 private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         if (AddNodeRadioButton.Checked)
         {
             if (checkBox1.Checked)
             {
                 counter++;
                 Val = int.Parse(ValueTB.Text) + counter;
             }
             else
             {
                 Val = int.Parse(ValueTB.Text);
             }
             Graph.AddNode(e.X, e.Y, Val);
         }
         else if (MoveNodeRadioButton.Checked)
         {
             Graph.MoveNode(e.X, e.Y);
         }
         else if (AddEdgeRadioButton.Checked)
         {
             Graph.CreateEdge(e.X, e.Y, int.Parse(ValueTB.Text));
         }
         else if (radioButtonDeleteNode.Checked)
         {
             Graph.DeleteNode(e.X, e.Y);
         }
         else if (radioButtonDeleteEdge.Checked)
         {
             Graph.DeleteEdge(e.X, e.Y);
         }
         Bitmap btm = new Bitmap(pictureBox1.Width, pictureBox1.Height);
         g = Graphics.FromImage(btm);
         Graph.DrawGraph(g);
         pictureBox1.Image = btm;
     }
 }