예제 #1
0
 private void Form1_MouseUp(object sender, MouseEventArgs e)
 {
     if (componentChosen != null)
     {
         componentChosen = null;
     }
     if (wireChosen != null)
     {
         (int x, int y) = wireChosen.Get_XY(1);
         foreach (InterfaceCanvas i in Document.interfaceList)
         {
             if (i.mouse_On(x, y))
             {
                 if (i.Get_type() == "pin")
                 {
                     Pin p = (Pin)i;
                     Document.interfaceList.Add(((Wire)wireChosen).P_from.Connect(p));
                     break;
                 }
             }
         }
         Document.interfaceList.Remove(wireChosen);
         wireChosen = null;
         CanvasPaint(this.CreateGraphics());
     }
 }
예제 #2
0
 private void Form1_MouseDown(object sender, MouseEventArgs e)
 {
     mouse_old_X = e.X;
     mouse_old_Y = e.Y;
     foreach (InterfaceCanvas i in Document.interfaceList)
     {
         if (i.mouse_On(e.X, e.Y))
         {
             if (i.Get_type() == "component")
             {
                 componentChosen = i;
                 Document.wireList.Add(i);
             }
             else
             {
                 Wire w = new Wire(e.X, e.Y, e.X, e.Y, (Pin)i);
                 Document.interfaceList.Add(w);
                 wireChosen = w;
             }
             break;
         }
     }
 }