Mobile no title bar window
Under normal circumstances, the need to form a mobile mouse drag can be placed in the window title bar, why insist on the use of the title bar? In fact, we can use a clever approach to the realization of the form will be placed in mouse click can drag on the form, the following look at the codes. Form1 in the "Private" part of the process statement:
In the private part by adding the following code:
Procedure wmnchittest (var msg: twmnchittest); message wm_nchittest;
In the process of adding the following code:
Procedure TForm1.wmnchittest (var msg: twmnchittest );?????????????
Begin ????????????????????????????????????????????????? ???????????
? Inherited ;??????????????????????????????????????????????? ??????
? If (htclient = msg.result) then msg.result: = htcaption ;??????????
End ;???????????????????????????????????????????????? ????????????
Above the key although only two lines of code, but it implements the mouse directly drag the purpose of the form. The principle is to use the code form the WM_NCHITTEST news, the news is that when the cursor movement, mouse or press release to happen, when the program detects a mouse click in the form of news (the news value of htClient), mouse click in the title bar when the news (value htCaption) transfer out, and this ingenious deception procedures that the title bar is pressed, of course, can be a drag form.








0 Comments to “Mobile no title bar window”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.