C # interface design. You can move the effect by dragging the mouse without borders,
Add variable at the beginning:
Point mouseOff; // the variable that moves the cursor.
Bool leftFlag; // whether the label is left
Event section:
1 private void Login_MouseMove (object sender, MouseEventArgs e) 2 {3 // Point to Detection 4 if (leftFlag) 5 6 {7 8 Point mouseSet = Control. mousePosition; 9 10 mouseSet. offset (mouseOff. x, mouseOff. y); // set the Moving position 11 12 Location = mouseSet; 13 14} 15 // 16} 17 18 private void Login_MouseUp (object sender, MouseEventArgs e) 19 {20 21 if (leftFlag) 22 23 {24 25 leftFlag = false; // After the mouse is released, mark it as false; 26 27} 28} 29 30 private void Login_MouseDown (object sender, mouseEventArgs e) 31 {32 if (e. button = MouseButtons. left) 33 34 {35 36 mouseOff = new Point (-e. x,-e. y); // get the variable value 37 38 leftFlag = true; // click the left button to press the time mark to true; 39 40} 41}
Ps: a few common characters.
Remember! Remember! Remember!