procedureImglistmousedown (sender:tobject; Button:tmousebutton; Shift:tshiftstate; X, Y:integer);Private procedureWmnchittest (varMsg:twmnchittest);messagewm_nchittest;procedureTfrmstarthit.wmnchittest (varmsg:twmnchittest);ConstCoffset=Ten;varVpoint:tpoint;begin inherited; Vpoint:=screentoclient (Point (Msg.xpos, Msg.ypos)); ifPtInRect (Rect (0,0, Coffset, Coffset), Vpoint) ThenMsg.result:=HttopleftElse ifPtInRect (Rect (Width-coffset, Height-coffset, Width, Height), Vpoint) ThenMsg.result:=HtbottomrightElse ifPtInRect (Rect (Width-coffset,0, Width, Coffset), Vpoint) ThenMsg.result:=HttoprightElse ifPtInRect (Rect (0, Height-coffset, Coffset, Height), Vpoint) ThenMsg.result:=HtbottomleftElse ifPtInRect (Rect (Coffset,0, Width-coffset, Coffset), Vpoint) ThenMsg.result:=HttopElse ifPtInRect (Rect (0, Coffset, Coffset, Height-coffset), Vpoint) ThenMsg.result:=HtleftElse ifPtInRect (Rect (Width-coffset, Coffset, Width, Height-coffset), Vpoint) ThenMsg.result:=HtrightElse ifPtInRect (Rect (Coffset, Height-coffset, Width-coffset, Height), Vpoint) ThenMsg.result:=Htbottom;End;procedureTfrmstarthit.imglistmousedown (sender:tobject; Button:tmousebutton; Shift:tshiftstate; X, Y:integer);ConstSc_dragmove=$F 012;begin if(Button = mbleft) Then beginreleasecapture; ( Self asTcontrol). Perform (Wm_syscommand, Sc_dragmove,0); End;End;
http://blog.csdn.net/yanjiaye520/article/details/6736069
Delphi to implement windowless movement (send wm_nchittest message calculation, and then send Wm_syscommand message, with parameter sc_dragmove)