|
How Do I Use It As Drag&Drop Source |
|
|
1. |
Drop a TWinControl on the form (e.g.
a panel). Place the image in it (more details: Specifics On Using
This Component). |
|
2. |
Choose the TWinControl (panel) in DragDropControl. |
|
3. |
Choose the drag&drop effects
under SourceEffects which the DragDropControl (panel)
should support. If you don't want any longer that the DragDropControl
serve as drag&drop source all items must be set to
false. |
|
4. |
Now, your DragDropControl
(panel) must detect, when the user wants to start a drag&drop
operation. You can use the event "OnMouseDown"
of your DragDropControl (panel).
Add following to the event:
DragDropBitmap1.Bitmap:=Image1.Picture.Bitmap;
|
|
5. |
Tell Windows that
there is a drag&drop operation to handle: Just call
the method Execute of this component. |
|
6. |
You may use
the events OnGiveFeedback and OnQueryContinueDrag, but often you need not. |
|
|
|
|
Hints: |
|
- Drag&drop
operations cannot be done at design-time!
- IMPORTANT: If you use
the drag-detection, it's high recommended to
check the section "Problems With The Drag-Detection".
|
|
|
|
How Do I Use It As Drag&Drop Target |
|
|
1. |
Drop a TWinControl on the form (e.g.
a panel). Place the image in it (more details: Specifics On Using
This Component). |
|
2. |
Choose the TWinControl (panel) in DragDropControl. |
|
3. |
Choose the drag&drop effects
under TargetEffects which the DragDropControl (panel)
should support. If you don't want any longer that the DragDropControl
serve as drag&drop target, all items must be set to
false. |
|
4. |
Now, you have to program
what happen, if the user drops a bitmap on your DragDropControl (panel). For this, the best is to
use the event OnProcessDropped. At first, you should check what
drag&drop effect was chosen by the user. You get the
effect from method's parameter dwEffect.
You get the bitmap from this component with following
line:
Image1.Picture.Bitmap:=DragDropBitmap1.Bitmap;
|
|
5. |
You may use
the events OnDragEnter, OnDragOver and OnDragLeave, but often you need not. |
|
|
|
|
Hints: |
|
- Drag&drop
operations cannot be done at design-time!
|
|
|