Add a variable at the beginning:
Point mouseoff;//mouse Move position variable
BOOL leftflag;//whether the label is left button
Event section:
1 Private voidLogin_mousemove (Objectsender, MouseEventArgs e)2 {3 //Mouse Pointing detection4 if(Leftflag)5 6 {7 8Point Mouseset =control.mouseposition;9 TenMouseset.offset (mouseoff.x, MOUSEOFF.Y);//set the position after the move One ALocation =Mouseset; - - } the // - } - - Private voidLogin_mouseup (Objectsender, MouseEventArgs e) + { - + if(Leftflag) A at { - -Leftflag =false;//label false after releasing the mouse; - - } - } in - Private voidLogin_mousedown (Objectsender, MouseEventArgs e) to { + if(E.button = =mousebuttons.left) - the { * $Mouseoff =NewPoint (-e.x,-e.y);//get the value of a variablePanax Notoginseng -Leftflag =true;//Click on the left button when the label is true; the + } A}
PS: A very common string of characters.
Remember! Remember! Remember!
C # Interface design, add a borderless form of the mouse drag to move the effect