www.JosXP.com, Joomla Professionals

Drag your Controls at runtime ...


Category:
GUI
API: GetCapture | SendMessage | ReleaseCapture | SetCapture | GetCursorPos | WindowFromPoint

Eight lines of code in the Form_MouseDown event, capable to drag any control on the form at runtime.

The idea consists to read the HWnd of the control when the user starts to drag the control (On Mouse Down), then send the message "WM_NCLBUTTONDOWN" to the control using its HWnd.

Using this code you can customize the form at runtime by saving the new positions on form unload for example.




Trick Never Seen Before!