Microsoft KB Archive/192171

= BUG: OLEDragDrop Fails on Contained Windowless Controls =

Article ID: 192171

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q192171



SYMPTOMS
Setting the ControlContainer property of a User Control to True allows a developer or end user to place a control on the User Control at the control's run-time. If you place a Windowless control on the User Control when the User Control is in run-time, the Windowless control's OLEDragDrop will fail. You will be able to drag over the control but the mouse cursor will never change to let you know that you can do a drop.



RESOLUTION
Use a windowed control.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



MORE INFORMATION
Setting the ControlContainer property to True allows you to develop a control that can contain other controls in the same way the PictureBox control can contain other controls. When a windowless control is the contained control on a User Control, the no-drop cursor doesn't change and releasing the mouse over the control has no effect when you are doing an OLEDragDrop.

Steps to Reproduce Behavior
 Create a new Standard EXE project in Visual Basic. Form1 is created by default. From the Project menu, select Components, check "Microsoft Windowless Controls 6.0," then click OK. If you don't have the Windowless controls Installed, please see the REFERENCES section for how to install them. From the Project menu, select Add User Control. Set the ControlContainer property to True and the BackColor of the User Control to some color you can see. Place a TextBox and UserControl1 onto Form1. Place a WLText control on the instance of UserControl1 that is on Form1.</li> Set the following properties for Text1:

OLEDragMode = 1-Automatic OLEDropMode = 2-Automatic

</li> Set the following properties for WLText1:

OLEDragMode = 1-wlOLEDragAutomatic OLEDropMode = 2-wlOLEDropAutomatic

</li> Save and run the project. Try highlighting the text in Text1, then dragging it over WLText1. You will see that the mouse drag cursor does not change to a drop cursor.</li> Stop the project and remove the WLText1 from UserControl1. Repeat step 4 but use a standard TextBox.</li> Set the following properties for Text2:

OLEDragMode = 1-Automatic OLEDropMode = 2-Automatic

</li> Repeat step 7 and you will be able to do a drag and drop to Text2.</li></ol>

<div class="references_section">