TDragDropBitmap

 
     

 

 

  Description
 
  TDragDropBitmap is a comfortable and powerful component for COM/OLE drag&drop operations with bitmaps. The component is a child-class from TDragDrop.
   
  Important for Use
 
  This file (index.htm) contains more information about restrictions, the disclaimer, remarks etc.
   
  History
 
  Version 2.10 published on 06-Jul-1999
 
  • Code re-design in result of modifications in TDragDrop; handling hasn't changed
  Version 2.01 published on 07-Oct-1998
 
  • Small invisible bugs fixed
  Version 2.00 published on 03-Oct-1998
 
  • Total internal re-design due to modifications of the superclass, but the handling hasn't changed
  Version 1.00 published on 06-Aug-1998
 
  • First official release
   
  Properties
 
  inherited properties
  Click here ...
 
  Bitmap public
  For Target: Use this bitmap in OnProcessDropped, if you want to get the dropped bitmap (DIB).

For Source: Assign your bitmap, which you want to drag&drop, to Bitmap before calling Execute.

 
  Events
 
  inherited events
  Click here ...
 
  Methods
 
  inherited methods
  Click here ...
 
  Execute public
  Call this method, if you detect that the user wants to start a drag&drop operation (e.g. MouseDown+MouseMove). Also look: Bitmap.

For drag detection you can also use the inherited property AutotDetectDnD or the method StartDnDDetection.

IMPORTANT: If you use the drag-detection, it's high recommended to check the section "Problems With The Drag-Detection".

 
  Specfics On Using This Component
 
  You can't use a TImage as DragDropControl, because TImage isn't derivatived from TWinControl. You can only do that with a small trick: Put a panel under your image and you haven't to think about any trouble. Use the event "OnMouseDown" from the TImage to start drag&drop otherwise it doesn't work.
   
  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!
   
  Known Bugs
 
 
  • I hope you never find one
   

© 1998,99 by Dieter Steinwedel

Back to index