![]() |
|
#1
|
|||
|
|||
|
Hello. What is the best way to drag a component over the screen? I can't use the onMouseMove Event because the component is too small and loses its attachment. I also just saw that using Application.OnMessage for MouseMove can make the cpu work at 100%!!! Tx alot [b] Derek )
|
|
#2
|
|||
|
|||
|
Hi,
Try this... procedure TForm1.BitBtn1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); const SC_DragMove = $F012; begin Begin ReleaseCapture; BitBtn1.perform(WM_SysCommand, SC_DragMove, 0); End; end; Good Luck. Thanx Tomy. |
|
#3
|
|||
|
|||
|
I'm not sure if I understand your question. Why aren't using the integrated drag&drop features of Delphi?
Just change the DragMode of the control you want to move to dmAutomatic, or call the BeginDrag method of the control by any other way. If you want to move the control while dragging, then put the following code in the OnDragOver handler of any control that should accept the dragged control (putting it on the form won't make a child accept it): if Source is TControl then begin with TControl(Source) do SetBounds( X, Y, Width, Height); Accept := True; end; You might want to test Source = MyControl or Source is MyControlClass instead... |
|
#4
|
|||
|
|||
|
Got another way, but thank guys :-) [b] Derek )
|
|
#5
|
|||
|
|||
|
Why use a bit button?
what does it do that the standard button doesn't? thanks "Shhh!....Zog,Here Come one Now" |
|
#6
|
|||
|
|||
|
so..If say I had an Text editor program I was making.
AndI wanted to allow for the user to load an image, then drag it to a position of his/her choosing... All I have to to is on the component at design time, set the dragMode to Automatic? thanks "Shhh!....Zog,Here Come one Now" |
![]() |
| Thread Tools | |
| Display Modes | |
|
|