home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Visual Basic.60 / VB98 / TEMPLATE / CONTROLS / TVLV.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-06-26  |  5.5 KB  |  172 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11d2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  3. Begin VB.Form frmTreeviewListviewTemplate 
  4.    Caption         =   "ffff"
  5.    ClientHeight    =   5220
  6.    ClientLeft      =   -9996
  7.    ClientTop       =   2292
  8.    ClientWidth     =   5676
  9.    LinkTopic       =   "Form1"
  10.    LockControls    =   -1  'True
  11.    ScaleHeight     =   5220
  12.    ScaleWidth      =   5676
  13.    Begin VB.PictureBox picTitles 
  14.       Align           =   1  'Align Top
  15.       Appearance      =   0  'Flat
  16.       BorderStyle     =   0  'None
  17.       ForeColor       =   &H80000008&
  18.       Height          =   285
  19.       Left            =   0
  20.       ScaleHeight     =   462.08
  21.       ScaleMode       =   0  'User
  22.       ScaleWidth      =   5797.147
  23.       TabIndex        =   1
  24.       TabStop         =   0   'False
  25.       Top             =   0
  26.       Width           =   5676
  27.       Begin VB.Label lblTitle 
  28.          BorderStyle     =   1  'Fixed Single
  29.          Caption         =   " Treeview:"
  30.          Height          =   255
  31.          Index           =   0
  32.          Left            =   0
  33.          TabIndex        =   3
  34.          Top             =   15
  35.          Width           =   1995
  36.       End
  37.       Begin VB.Label lblTitle 
  38.          BorderStyle     =   1  'Fixed Single
  39.          Caption         =   " Listview:"
  40.          Height          =   255
  41.          Index           =   1
  42.          Left            =   2010
  43.          TabIndex        =   2
  44.          Top             =   15
  45.          Width           =   3180
  46.       End
  47.    End
  48.    Begin VB.PictureBox picSplitter 
  49.       BackColor       =   &H00808080&
  50.       BorderStyle     =   0  'None
  51.       FillColor       =   &H00808080&
  52.       Height          =   4800
  53.       Left            =   5400
  54.       ScaleHeight     =   5012.637
  55.       ScaleMode       =   0  'User
  56.       ScaleWidth      =   260
  57.       TabIndex        =   0
  58.       Top             =   315
  59.       Visible         =   0   'False
  60.       Width           =   156
  61.    End
  62.    Begin MSComctlLib.TreeView tvTreeView 
  63.       Height          =   4800
  64.       Left            =   -15
  65.       TabIndex        =   5
  66.       Top             =   315
  67.       Width           =   2010
  68.       _ExtentX        =   3535
  69.       _ExtentY        =   8467
  70.       _Version        =   393217
  71.       Style           =   7
  72.       Appearance      =   1
  73.    End
  74.    Begin MSComctlLib.ListView lvListView 
  75.       Height          =   4800
  76.       Left            =   2040
  77.       TabIndex        =   4
  78.       Top             =   315
  79.       Width           =   3210
  80.       _ExtentX        =   5673
  81.       _ExtentY        =   8467
  82.       LabelWrap       =   -1  'True
  83.       HideSelection   =   -1  'True
  84.       _Version        =   393217
  85.       ForeColor       =   -2147483640
  86.       BackColor       =   -2147483643
  87.       Appearance      =   1
  88.       NumItems        =   0
  89.    End
  90.    Begin VB.Image imgSplitter 
  91.       Height          =   4785
  92.       Left            =   1965
  93.       MouseIcon       =   "Treeview Listview Splitter.frx":0000
  94.       MousePointer    =   99  'Custom
  95.       Top             =   315
  96.       Width           =   150
  97.    End
  98. Attribute VB_Name = "frmTreeviewListviewTemplate"
  99. Attribute VB_GlobalNameSpace = False
  100. Attribute VB_Creatable = False
  101. Attribute VB_PredeclaredId = True
  102. Attribute VB_Exposed = False
  103. Const NAME_COLUMN = 0
  104. Const TYPE_COLUMN = 1
  105. Const SIZE_COLUMN = 2
  106. Const DATE_COLUMN = 3
  107. Dim mbMoving As Boolean
  108. Const sglSplitLimit = 500
  109. Private Sub Form_Resize()
  110.   If Me.Width < 3000 Then Me.Width = 3000
  111.   SizeControls imgSplitter.Left
  112. End Sub
  113. Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  114.   With imgSplitter
  115.     picSplitter.Move .Left, .Top, .Width - 20, .Height - 20
  116.   End With
  117.   picSplitter.Visible = True
  118.   mbMoving = True
  119. End Sub
  120. Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  121.   Dim sglPos As Single
  122.   If mbMoving Then
  123.     sglPos = X + imgSplitter.Left
  124.     If sglPos < sglSplitLimit Then
  125.       picSplitter.Left = sglSplitLimit
  126.     ElseIf sglPos > Me.Width - sglSplitLimit Then
  127.       picSplitter.Left = Me.Width - sglSplitLimit
  128.     Else
  129.       picSplitter.Left = sglPos
  130.     End If
  131.   End If
  132. End Sub
  133. Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  134.   SizeControls picSplitter.Left
  135.   picSplitter.Visible = False
  136.   mbMoving = False
  137. End Sub
  138. Sub SizeControls(X As Single)
  139.   On Error Resume Next
  140.   'set the width
  141.   If X < 1500 Then X = 1500
  142.   If X > (Me.Width - 1500) Then X = Me.Width - 1500
  143.   tvTreeView.Width = X
  144.   imgSplitter.Left = X
  145.   lvListView.Left = X + 40
  146.   lvListView.Width = Me.Width - (tvTreeView.Width + 140)
  147.   lblTitle(0).Width = tvTreeView.Width
  148.   lblTitle(1).Left = lvListView.Left + 20
  149.   lblTitle(1).Width = lvListView.Width - 40
  150.   'set the top
  151. '  If tbToolBar.Visible Then
  152. '    tvTreeView.Top = tbToolBar.Height + picTitles.Height
  153. '  Else
  154.     tvTreeView.Top = picTitles.Height
  155. '  End If
  156.   lvListView.Top = tvTreeView.Top
  157.   'set the height
  158. '  If sbStatusBar.Visible Then
  159. '    tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height + sbStatusBar.Height)
  160. '  Else
  161.     tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height) ' + h)
  162. '  End If
  163.   lvListView.Height = tvTreeView.Height
  164.   imgSplitter.Top = tvTreeView.Top
  165.   imgSplitter.Height = tvTreeView.Height
  166. End Sub
  167. Private Sub tvTreeView_DragDrop(Source As Control, X As Single, Y As Single)
  168.   If Source = imgSplitter Then
  169.     SizeControls X
  170.   End If
  171. End Sub
  172.