Previous | Index | Next 

[INFO] How VB Migration Partner implements drag-and-drop features

VB Migration Partner fully supports OLE drag-and-drop features. Starting with version 1.20, “classic” drag-and-drop is also supported.

When the drag-and-drop operation is initiated automatically – which happens always when using “classic” drag-and-drop and can happen with OLE drag-and-drop when the OLEDragMode property is set to 1-vbOLEDragAutomatic – there are a couple important differences from VB6:

  1. an automatic drag-and-drop operation can be initiated by pressing the either the left or the right mouse button and then dragging (VB6 only supports the left button). Supporting the mouse button is necessary for controls that can contain editable text (e.g. the TextBox control), because dragging with the left button would change the text selection.
  2. The drag operation begins only when the mouse cursor is moved outside the source control’s border. Only after this point all events that are related to drag-and-drop – e.g. OLEStartDrag) will fire.

 “Classic” drag-and-drop
From the end users’ perspective, an important difference is what they see when they initiate a drag operation and the DragIcon property is Nothing. In VB6 the mouse cursor is replaced by the rectangular outline of the control being dragged, whereas in converted VB.NET application a default icon is used.

If you aren’t satisfied with the default icon, you can use a custom icon by assigning a Bitmap object to the VB6Config.DragIcon property, as in:

        VB6Config.DragIcon = LoadPicture6("c:\dragicon.bmp")

Another minor difference with the VB6 behavior: if you end an ongoing drag operation by means of the Drag method, the target control receives a DragDrop event immediately (as in VB6), but the user interface will be inactive and no other mouse-related event will be fired until you release the mouse button.

OLE drag-and-drop
Except for the two points described above, the support for OLE drag-and-drop is complete.

Consider, however, that the RichTextBox control reacts to automatic drag-and-drop in a peculiar way and has an inconsistent behavior when a file is dropped on it, for example at the end of a drag-and-drop operation initiated from Windows Explorer: depending on the nature of the file, the RichTextBox control either displays the file contents or the file icon and name. The VB.NET version of the RichTextBox always displays the file contents. You can work around these issues by using OLE drag-and-drop in manual mode.

 

Previous | Index | Next