home *** CD-ROM | disk | FTP | other *** search
- NUMBER : 2909
- PRODUCT : Delphi
- VERSION : All
- OS : Windows/Win32
- DATE : June 14, 1996
-
- TITLE : How to click and move components at runtime.
-
- Q: How can I program a component, such as a TPanel, so that I
- can move it around with a click and drag of the mouse?
-
- A: This code goes on the OnMouseDown event of the component in
- question (a TPanel in this case):
-
- procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- const
- SC_DragMove = $F012; { a magic number }
- begin
- ReleaseCapture;
- panel1.perform(WM_SysCommand, SC_DragMove, 0);
- end;
-
-
-
- DISCLAIMER: You have the right to use this technical information
- subject to the terms of the No-Nonsense License Statement that
- you received with the Borland product to which this information
- pertains.
-