中间放一个picturebox无边框,处理他的拖动事件

解决方案 »

  1.   

    不好,放一个LABEL,这样可以节省系统资源,速度会更快一些.
    这是我的代码,你可以参考:
    Private Sub Bar_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
    sx = X
    sy = Y
    End If
    End SubPrivate Sub Bar_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
    Bar.Top = 0
    Bar.Move Bar.Left + X - sx
    trv.Width = Bar.Left
    lstv.Left = trv.Width + Bar.Width
    lstv.Width = Me.ScaleWidth - trv.Width - Bar.Width
    End If
    End Sub
    '说明:bar是一个LABEL
    'lstv 是listview
    'trv是treeview
      

  2.   

    Dim sx As Long
    Dim sy As Long
    还要加上模块级的声明,储存鼠标的初始位置.