home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1996 December / CD_shareware_12-96.iso / DOS / Programa / TI2909.ZIP / TI2909.ASC < prev   
Encoding:
Text File  |  1996-06-17  |  895 b   |  30 lines

  1.    NUMBER  :  2909
  2.   PRODUCT  :  Delphi
  3.   VERSION  :  All
  4.        OS  :  Windows/Win32
  5.      DATE  :  June 14, 1996                           
  6.  
  7.     TITLE  :  How to click and move components at runtime.
  8.  
  9. Q:  How can I program a component, such as a TPanel, so that I 
  10. can move it around with a click and drag of the mouse?
  11.  
  12. A:  This code goes on the OnMouseDown event of the component in 
  13. question (a TPanel in this case):
  14.  
  15. procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
  16.     Shift: TShiftState; X, Y: Integer);
  17. const
  18.   SC_DragMove = $F012;  { a magic number }
  19. begin
  20.   ReleaseCapture;
  21.   panel1.perform(WM_SysCommand, SC_DragMove, 0);
  22. end;
  23.  
  24.  
  25.  
  26. DISCLAIMER: You have the right to use this technical information
  27. subject to the terms of the No-Nonsense License Statement that
  28. you received with the Borland product to which this information
  29. pertains.
  30.