Implementing OLE Drag and Drop
In this exercise, you will use Visual Basic to create an application that supports drag-and-drop functionality.
* To add drag and drop support to an application
- Start Visual Basic and create a new Standard EXE project.
- Add two picture controls to the form.
- Set the OLEDragMode and OLEDropMode properties of both controls to Automatic .
- Add a bitmap image to the Picture1 control.
- Start the application and drag and drop the bitmap from Picture1 to Picture2 .
* To add drag-and-drop support between applications - Stop the application and add a textbox to the form.
- Set the Multiline property of Text1 to True .
- Clear the text field.
- Set the OLEDragMode and OLEDropMode property of the control to Automatic .
- Start the application.
- Start Microsoft Word and create a new blank document.
- Position the windows so you can see both at the same time.
- Type Hello World! in the Word document.
- Highlight the text and drag and drop it into the text box on the Visual Basic form.
- Drag and drop the bitmap from the Picture1 control into the Word for Windows document.
- Stop the Visual Basic application.
- Exit both Word for Windows and Visual Basic.