Form2.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace DllXqManager
  11. {
  12. public partial class Form2 : Form
  13. {
  14. private Point CurrPoint = new Point(0, 0);
  15. private bool CurrMove = false;
  16. public Form2()
  17. {
  18. InitializeComponent();
  19. }
  20. private void tEntityControl1_MouseDown(object sender, MouseEventArgs e)
  21. {
  22. CurrMove = true;
  23. CurrPoint.X = e.X;
  24. CurrPoint.Y = e.Y;
  25. (sender as Control).BringToFront();
  26. }
  27. private void tEntityControl1_MouseMove(object sender, MouseEventArgs e)
  28. {
  29. if (!CurrMove)
  30. return;
  31. (sender as Control).Left = (sender as Control).Left + e.X - CurrPoint.X;
  32. (sender as Control).Top = (sender as Control).Top + e.Y - CurrPoint.Y;
  33. }
  34. private void tEntityControl1_MouseUp(object sender, MouseEventArgs e)
  35. {
  36. CurrMove = false;
  37. }
  38. }
  39. }