CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2000
    Posts
    57

    OLE Drag Drop for treeView control

    I have a tree view control in my application. I want to drag a node from applications tree view control and drop it in another application. While dragging I want a paticular icon to be displayed against mouse pointer. Could anyone help me in doing this. I have tried DragIcon property but that changes the icon if you drag the control rather than the contents of the control. I also tries the screen.mousepointer and screen.mouseicon properties but could not achieve the desired function. Any help in this regard will be greated appreciated.

    Thanks

    Ali.



  2. #2
    Join Date
    Nov 2001
    Posts
    2

    Re: OLE Drag Drop for treeView control

    If you want to change the mouse pointer, you need to respond to the _OLEGiveFeedback event.
    In the event handler for the control, first set "DefaultCursors" to false, then you can change the cursor through the Screen object.

    Example:
    Private Sub UserControl_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
    DefaultCursors = False
    Screen.MouseIcon = imglstDrag.ListImages.Item(GetDragImgID(m_DragNode.Tag.typeobj)).ExtractIcon
    Screen.MousePointer = vbCustom
    End Sub


    Its kind of obsurce, but Microsoft actually documented it in the documented titled:

    Dragging the OLE Drag Source over the OLE Drop Target

    In the Visual Basic Concepts section of the MSDN library


  3. #3
    Join Date
    Nov 2001
    Posts
    2

    Re: OLE Drag Drop for treeView control

    I should have also mentioned that with the tree control, you will be responding to an event like TreeView1_OLEGiveFeedback, not usercontrol (as in the code example). Also, in the _OLECompleteDrag, you will need to set the screen.mousepointer back to vb default.


  4. #4
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: OLE Drag Drop for treeView control

    Treeview has a createDragImage property using which you can set an image.. i will check if i can provide you the code..


    RK

  5. #5
    Join Date
    Nov 2000
    Posts
    57

    Re: OLE Drag Drop for treeView control

    Thankyou very much for your help.

    Regards

    Ali.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured