C # Move and drag a borderless form

Source: Internet
Author: User

Paste in the custom control or form code

Const int htleft = 10; <br/> const int htright = 11; <br/> const int httop = 12; <br/> const int httopleft = 13; <br/> const int httopright = 14; <br/> const int htbottom = 15; <br/> const int htbottomleft = 0x10; <br/> const int htbottomright = 17; </P> <p> protected override void wndproc (ref message m) <br/>{< br/> switch (M. MSG) <br/>{< br/> case 0x0084: <br/> base. wndproc (ref m); <br/> point vpoint = new point (INT) M. lparam & 0 xFFFF, <br/> (INT) M. lparam> 16 & 0 xFFFF); <br/> vpoint = pointtoclient (vpoint); <br/> If (vpoint. x <= 5) <br/> If (vpoint. Y <= 5) <br/> M. result = (intptr) httopleft; <br/> else if (vpoint. y> = clientsize. height-5) <br/> M. result = (intptr) htbottomleft; <br/> else M. result = (intptr) htleft; <br/> else if (vpoint. x> = clientsize. width-5) <br/> If (vpoint. Y <= 5) <br/> M. result = (intptr) httopright; <br/> else if (vpoint. y> = clientsize. height-5) <br/> M. result = (intptr) htbottomright; <br/> else M. result = (intptr) htright; <br/> else if (vpoint. Y <= 5) <br/> M. result = (intptr) httop; <br/> else if (vpoint. y> = clientsize. height-5) <br/> M. result = (intptr) htbottom; <br/> break; <br/> case 0x0201: // message that is left-clicked <br/> M. MSG = 0x00a1; // change the message to a non-customer zone by pressing the mouse <br/> M. lparam = intptr. zero; // default value <br/> M. wparam = new intptr (2); // place the cursor in the title bar <br/> base. wndproc (ref m); <br/> break; <br/> default: <br/> base. wndproc (ref m); <br/> break; <br/>}< br/>}

From: http://www.cnblogs.com/jiangshui/archive/2010/01/11/1644393.html

I'm afraid I cannot find it again. Reprinted. Pai_^

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.