private void Switch_Click(object sender, EventArgs e) { Input_Front s = new Input_Front(); this.Controls.Add(s); }
private void INPUT_MouseDown(object sender, MouseEventArgs e) { textBoxLocation.Text = ActiveControl.Name.ToString(); Input_Front newGate = new Input_Front (); Form1.getInstance().switches.Add(newGate); //GateFrontList.Add(newGate); Point d; d = Gate_Front.MousePosition; if (d.X < 2 * flowLayoutPanel1.Right && d.X > 0) { DoDragDrop(newGate, DragDropEffects.Link); newGate.Parent = panel2; mousePos = Gate_Front.MousePosition; // int dx = mousePos.X - DecentUserControlChild.Width - panel2.Left; // int dy = mousePos.Y - panel2.Top - 3 * DecentUserControlChild.Height + DecentUserControlChild.Height / 2; newGate.Location = new Point(mousePos.X - panel2.Left - 3 * newGate.Width / 2, mousePos.Y - 100); } }