C # Interface design, add a borderless form of the mouse drag to move the effect

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.