1. Do a message mapping for WM_NCHITTEST.
Begin_MESSAGE_MAP Message_Handler (WM_NCHITTEST, TMESSAGE, WMNCHITEST) END_MESSAGE_MAP (TFORM)
2, then add the following code in the message processing function:
void __fastcall TDragForm :: WMNCHitTest (TMessage & Msg) {int xPos, yPos; xPos = LOWORD (Msg.LParam); yPos = HIWORD (Msg.LParam); TPoint Pxy; Pxy = Point (xPos, yPos); Pxy = ScreenToClient ( PXY); BOOL MDRAG1 = PtinRect (& (Shape1-> BoundSRect), PXY); if (getasynckeyState (vk_lbutton <0 && mdrag1) msg.result = htcaption; else msg.result = htclient;}
(Shape1-> BoundSRect is the setting area) so you can remove the blue title bar of the ordinary window, change a better look.)