Also talk about the drag and drop in the title window

zhaozj2021-02-11  185

There is a story of Mr. Song Libo "Windows Advanced Window Customer Regional Drain Technology and Its Application" to the window drag technology, a lot of meticulous elaboration, but for me, I know that it is difficult to say, it is very difficult, and to deal with There are too many details, and later seen from Microsoft's site, you don't have to calculate REC, you don't have to deal with the details of the mouse message and window drawing, you can easily implement window movement without the title bar, that is, use OnnchitTest message. . Handmade this message mapping: Use classwizard that cannot add this message, add message on_wm_nchittest () in Begin_MESSAGE_MAP, and add AFX_MSG uint onnchittest (CPOINT POINT) in the header file; add the LButtondown message function void cclyzdlg: : OnLButtonDown (UINT nFlags, CPoint point) {CTranDialog :: OnLButtonDown (nFlags, point); // put into your base class CTranDialog PostMessage (WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM (point.x, point.y));} was added Nchittest message function uint cclyzdlg :: Onnchittest (cpoint point) {uint nhittest = cTrandialog :: OnnithTest (Point); // Remove CTRANDIALOG to your base class Return (nhittest == htclient)? Htcaption: nhittest;} Compile operation, If there is no error, it will be completed, and the ten row code is not before and after. I use the dialog-based application, compiled in VC6.0, WinNT4.0, and run well. My email address is cd_yuan@sina.com, no personal homepage, no sample code.

转载请注明原文地址:https://www.9cbs.com/read-3949.html

New Post(0)