Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
'加三个PICTUREBOX控件,picture1 中装载TREEVIEW,picSplit作为分隔条,picture2 作为显示窗口
Private Sub Form_Load()
Dim i As Long
Picture1.Left = 60
Picture1.Top = 60
TreeView1.Move Picture1.Left, Picture1.Top, Picture1.Width, Picture1.Height
TreeView1.LineStyle = tvwTreeLines
Picture2.Top = 60
Picsplit.Left = Picture1.Left + Picture1.Width + 30
Picsplit.Width = 60
Picsplit.BorderStyle = 0
Picture2.Left = Picsplit.Left + Picsplit.Width '+ 50
Picture1.Height = 5700
Picture2.Height = 5700
Picsplit.Top = 60
Picsplit.Height = 5700
Picsplit.MousePointer = vbSizeWE
TreeView1.Nodes.Add , , "all", "all"
TreeView1.Nodes(1).Expanded = True
For i = 0 To 100
TreeView1.Nodes.Add "all", 4, , i
Next
End Sub
Private Sub picSplit_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
If Button = vbLeftButton Then
SetCapture Picsplit.hwnd
Picsplit.Tag = x
Picsplit.BackColor = &HFF8080
End If
End Sub
Private Sub picSplit_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
If Button = vbLeftButton Then
If Picsplit.Left >= (100 - x) And Picsplit.Left <= (Me.ScaleWidth - 100 - x) Then Picsplit.Left = Picsplit.Left + x - CInt(Picsplit.Tag)
End If
End Sub
Private Sub picSplit_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
If Button = vbLeftButton Then
Picture1.Width = Picsplit.Left - 80
Picture2.Left = Picsplit.Left + 50
Picture2.Width = Width - Picsplit.Left - 250
Picsplit.BackColor = &H8000000F
ReleaseCapture
End If
End Sub
Private Sub Picture1_Resize()
TreeView1.Move Picture1.Left, Picture1.Top, Picture1.Width, Picture1.Height
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
Picture2.Cls
Picture2.FontSize = 50
Picture2.Print Node.Text
End Sub