Untitled window dragging

Source: Internet
Author: User

LRESULT CbarDlg: OnNcHitTest (CPoint point) {// TODO: add the message processing program code and/or call the default const int borderwidth = 7; CRect rect; GetClientRect (rect ); screenToClient (& point); if (point. y <borderwidth) {return HTTOP;} if (point. x <borderwidth) {return HTLEFT;} if (point. y> rect. bottom-rect. top-borderwidth & point. x> rect. right-rect. left-borderwidth) return HTBOTTOMRIGHT; if (point. y> rect. bottom-rect. top-borderwidth) {return HTBOTTOM;} if (point. x> rect. right-rect. left-borderwidth) {return HTRIGHT;} return HTCAPTION; // return CDialog: OnNcHitTest (point);} void CbarDlg: OnNcLButtonDown (UINT nHitTest, CPoint point) {// TODO: add the message processing program code and/or call the default value if (nHitTest = HTTOP) sendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_TOP, MAKELPARAM (point. x, point. y); else if (nHitTest = HTBOTTOM) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_BOTTOM, MAKELPARAM (point. x, point. y); else if (nHitTest = HTLEFT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_LEFT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTRIGHT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_RIGHT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTTOPLEFT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_TOPLEFT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTTOPRIGHT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_TOPRIGHT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTBOTTOMLEFT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_BOTTOMLEFT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTBOTTOMRIGHT) SendMessage (WM_SYSCOMMAND, SC _SIZE | WMSZ_BOTTOMRIGHT, MAKELPARAM (point. x, point. y); else if (nHitTest = HTCAPTION) SendMessage (WM_SYSCOMMAND, SC _MOVE | 4, MAKELPARAM (point. x, point. y ));}

 

Related Article

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.