亲爱的朋友,你在此处留下你的email,我发给你!

解决方案 »

  1.   

    Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
        Set TreeView1.DropHighlight = TreeView1.HitTest(x, y)
        If Not TreeView1.DropHighlight Is Nothing Then
            TreeView1.SelectedItem = TreeView1.HitTest(x, y)
            Set moDragNode = TreeView1.SelectedItem ' Set the item being dragged.
        End If
        Set TreeView1.DropHighlight = Nothing
    End SubPrivate Sub TreeView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        If Button = vbLeftButton Then 
            mbIndrag = True 
            TreeView1.DragIcon = TreeView1.SelectedItem.CreateDragImage
            TreeView1.Drag vbBeginDrag ' Drag operation.
        End If
    End SubPrivate Sub TreeView1_DragDrop(Source As Control, x As Single, y As Single)
    If TreeView1.DropHighlight Is Nothing Then
            mbIndrag = False
            Exit Sub
        Else
            On Error GoTo checkerror
            Set moDragNode.Parent = TreeView1.DropHighlight
            Set TreeView1.DropHighlight = Nothing
            mbIndrag = False
            Set moDragNode = Nothing
            Exit Sub
        End If
     
    checkerror:
        
        Const CircularError = 35614
        If Err.Number = CircularError Then
            Dim msg As String
            msg = "A node can't be made a child of its own children."
            If MsgBox(msg, vbExclamation & vbOKCancel) = vbOK Then
                mbIndrag = False
                Set TreeView1.DropHighlight = Nothing
                Exit Sub
            End If
        End If
    End SubPrivate Sub TreeView1_DragOver(Source As Control, x As Single, y As Single, State As Integer)
        If mbIndrag = True Then
            Set TreeView1.DropHighlight = TreeView1.HitTest(x, y)
        End If
    End Sub
      

  2.   

    如需示例,就再联系![email protected]
      

  3.   

    我的Email:[email protected]
    谢以后多联系!
      

  4.   

    另请各位大侠,问有没有什么方法将控件的树型结构打印下来?急需最好有源程序发送我的邮箱:[email protected],thanks!
      

  5.   

    HOWTO: Scroll the TreeView When Dragging and Dropping a Node
    http://support.microsoft.com/support/kb/articles/Q177/7/43.aspFILE: TREEVIEW: Manipulating and Saving the Nodes in a TreeView Control 
    http://support.microsoft.com/support/kb/articles/Q172/2/72.ASP