Q1:可以用PictureBox来做分隔线,在PictureBox的Mousemove事件中判断鼠标左键是否按下,若按下,将PictureBox移动到鼠标的位置,在PictureBox的的Mouseup事件中调整Treeview和Listview的位置。Q2:设置HideSelection属性为false

解决方案 »

  1.   

    学我做,新建->VB应用程序向导->资源管理器样式·看看吧,符合你要求嘛?
      

  2.   

    我在TreeView和ListView中加入了Picture.
    但是我下面的代码不正常,能帮我看看吗?
    这样写好吗?谢谢!Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        Picture1.MousePointer = 9
        If Button = 1 Then
            Picture1.Left = Picture1.Left + x
            TreeView1.Width = TreeView1.Width + x
            ListView1.Left = ListView1.Left + x
            ListView1.Width = ListView1.Width - x    End If
    End Sub
      

  3.   

    Private Sub Form_Load()
    Picture1.Move TreeView1.Left + TreeView1.Width, TreeView1.Top, ListView1.Left - TreeView1.Left - TreeView1.Width, TreeView1.Height
    Picture1.BorderStyle = 0
    End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        Picture1.MousePointer = 9
        If Button = 1 Then
            Picture1.Left = Picture1.Left + x
            TreeView1.Width = TreeView1.Width + x
            ListView1.Left = ListView1.Left + x
            ListView1.Width = ListView1.Width - x
        End If
    End Sub
      

  4.   

    '鼠标在picAdjust上按下时相对于picAdjust.Left的位置
    Dim iMouseClickX As IntegerPrivate Sub picAdjust_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        iMouseClickX = X - picAdjust.Left
    End SubPrivate Sub picAdjust_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = 1 Then '若是左键按下
            If Shift = 0 Then 'SHIFT,CTRL,和 ALT 键没有被按下
                picAdjust.Left = X - iMouseClickX
                
                TreeView1.Width = picAdjust.Left
                ListView1.Left = TreeView1.Width + picAdjust.Width
                ListView1.Width = Me.ScaleWidth - ListView1.Left
            End If
        End If
    End Sub