void PictureBoxMainMouseClick(object sender, MouseEventArgs e) { if (radioButtonAddNew.Checked == true) { DrawNewNode(new Point(e.X, e.Y)); } if (radioButtonDelNode.Checked == true) { TPositionNode = MainGraph.Nodes.Find(x => (x.GetX() - TextPos <e.X && x.GetX() + TextPos> e.X) && (x.GetY() - TextPos <e.Y && x.GetY() + TextPos> e.Y)); if (TPositionNode != null) { TPositionNode.DeleteLinks(); MainGraph.DeleteNode(TPositionNode); TPositionNode = null; DrawNodes(); } } if (radioButtonDelLine.Checked == true) { TPositionNode = MainGraph.Nodes.Find(x => (x.GetX() - TextPos <e.X && x.GetX() + TextPos> e.X) && (x.GetY() - TextPos <e.Y && x.GetY() + TextPos> e.Y)); if (TPositionNode != null) { TPositionNode.DeleteLinks(); TPositionNode = null; DrawNodes(); } } }