CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Drag-Drop

  1. #1
    Join Date
    Apr 1999
    Posts
    11

    Drag-Drop

    If you begin dragging a file in Windows Explorer, you see that a 'ghost image' of the file is attached to your mouse cursor when you move around. How can I pick up such a 'ghost image', from an item in a listview or from a node in a treeview?

    Could someone help me out on this one?

    See you,

    Yves


  2. #2
    Join Date
    Apr 1999
    Posts
    11

    Re: Drag-Drop

    No need anymore, got it.


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

    Re: Drag-Drop

    Where?
    how to do it, I also want to know..



  4. #4
    Join Date
    Apr 1999
    Posts
    11

    Re: Drag-Drop

    Here is some code that works fine in case an item is picked up (begin drag) in a ListView1 and dropped in a TreeView1

    [vbcode]

    Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim itmX As ListItem
    If Button = 1 Then
    Set itmX = ListView1.SelectedItem
    End If
    'itmX. Other operations ... not of importance
    End Sub

    Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim itmX As ListItem
    If Button = vbLeftButton Then
    ListView1.DragIcon = ListView1.SelectedItem.CreateDragImage
    ListView1.Drag vbBeginDrag
    End If
    End Sub

    Private Sub TreeView1_DragDrop(Source As Control, x As Single, y As Single)
    Dim nodX As Node
    If Source Is ListView1 Then
    If Not TreeView1.DropHighlight Is Nothing Then
    Set nodX = TreeView1.DropHighlight
    'Operations on nodX if wanted --> eg create new subnode, ...

    Set TreeView1.DropHighlight = Nothing
    End If
    End If
    End Sub

    [\vbcode]

    Greetings

    Yves.


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