Create a mobile borderless window
In the graphic user interface, windows with border are common, and users can move them by dragging the borders. However, some applications may require a borderless window to achieve specific aesthetic effects or functions. But how to move these borderless windows?
Solution
A valid technique of creating a mobile borderless window is to use the Windows API function:
Define two constants: - means the message sent when pressing the left mouse button on the window,
indicates that the click occurs in the title bar. WM_NCLBUTTONDOWN
HT_CAPTION
Import the necessary functions: - Send messages to the window,
Release the mouse capture. SendMessage
ReleaseCapture
In the - event processing program in the window:
MouseDown
Check whether to press the left mouse button.
- If so, release the mouse capture and use
to send messages to the window, and set the - to
WM_NCLBUTTONDOWN
. wParam
HT_CAPTION
This code actually simulates the operation of clicking on the mouse on the title bar, allowing the window as usual.
The above is the detailed content of How Can I Make a Borderless Form Movable?. For more information, please follow other related articles on the PHP Chinese website!