private void ChangeContextBtn_Click(object sender, EventArgs e) { if (SelectedNode != null) { DrawGraph <int> draw = SelectedNode.Head == DrawA.graph ? DrawA : DrawB; GetValue get = new GetValue(); get.Value = SelectedNode.Value.V; if (get.ShowDialog() == DialogResult.OK) { SelectedNode.Value.V = get.Value; } UpdatePicter(draw == DrawA?OutputA:OutputB); } else if (SelectedEdge != null) { DrawGraph <int> draw = SelectedEdge.First.Head == DrawA.graph ? DrawA : DrawB; GetValue get = new GetValue(); get.Value = SelectedEdge.Value; if (get.ShowDialog() == DialogResult.OK) { SelectedEdge.Value = get.Value; } UpdatePicter(draw == DrawA ? OutputA : OutputB); } menuwork = false; SelectedNode = null; }
private void Output_MouseDown(object sender, MouseEventArgs e) { menuwork = false; DrawGraph <int> draw = sender == OutputA ? DrawA : DrawB; if (e.Button == MouseButtons.Right) { SelectedNode = draw.GetNode(e.Location); SelectedEdge = draw.GetEdge(e.Location); if (SelectedNode != null || SelectedEdge != null) { contextMenuStrip.Show((Control)sender, e.Location); } menuwork = true; return; } if (AddBtn.Checked) { if (draw.PlaceFree(e.Location)) { GetValue get = new GetValue(); if (get.ShowDialog() == DialogResult.OK) { draw.Add(get.Value, e.Location); UpdatePicter(sender); } } } if (AddEdge.Checked) { if (SelectedNode == null) { SelectedNode = draw.GetNode(e.Location); } else { if (SelectedNode.Head == draw.graph) { Node <NP <int> > T = draw.GetNode(e.Location); if (T != SelectedNode && T != null && T.GetEdge(SelectedNode) == null) { GetValue get = new GetValue(); if (get.ShowDialog() == DialogResult.OK) { SelectedNode.AddDualLinkedEdgeTo(T, get.Value); } UpdatePicter(sender); } SelectedNode = null; } else { SelectedNode = draw.GetNode(e.Location); } } } if (ChangeBtn.Checked) { SelectedNode = draw.GetNode(e.Location); } }