private void panel1_MouseClick(object sender, MouseEventArgs e)
 {
     if (type != ComponentType.NONE && type != ComponentType.PIPELINE)
     {
         Component c = myNetwork.CreateComponent(type, e.X, e.Y);
         if (panel1.DisplayRectangle.Contains(c.ComponentBox))
         {
             myNetwork.AddComponent(c);
         }
     }
     if (type == ComponentType.PIPELINE)
     {
         if (startComp == null)
         {
             startComp    = myNetwork.GetComponent(e.Location);
             startCompLoc = e.Location;
             return;
         }
         endComp = myNetwork.GetComponent(e.Location);
         if (endComp == null)
         {
             inbetweenPts.Add(e.Location);
             return;
         }
         endCompLoc = e.Location;
         myNetwork.RegisterPipeline(startComp, endComp, startCompLoc, endCompLoc, inbetweenPts);
         ClearVariables();
         type = ComponentType.NONE;
     }
     panel1.Invalidate();
 }