⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 vb控件vb控件vb控件vb控件vb控件vb控件vb控件
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5745
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6360
   LinkTopic       =   "Form1"
   ScaleHeight     =   5745
   ScaleWidth      =   6360
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command3 
      Caption         =   "退出(&X)"
      Height          =   465
      Left            =   4065
      TabIndex        =   3
      Top             =   4965
      Width           =   1980
   End
   Begin VB.CommandButton Command2 
      Caption         =   "驱动器(&D)"
      Height          =   495
      Left            =   4110
      TabIndex        =   2
      Top             =   780
      Width           =   1875
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   4125
      Top             =   1470
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   32
      ImageHeight     =   32
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   3
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":045C
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":08B0
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton Command1 
      Caption         =   "电脑(&C)"
      Height          =   495
      Left            =   4110
      TabIndex        =   1
      Top             =   195
      Width           =   1875
   End
   Begin MSComctlLib.TreeView TreeView1 
      Height          =   5235
      Left            =   300
      TabIndex        =   0
      Top             =   240
      Width           =   3345
      _ExtentX        =   5900
      _ExtentY        =   9234
      _Version        =   393217
      LabelEdit       =   1
      Style           =   7
      ImageList       =   "ImageList1"
      Appearance      =   1
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
    On Error Resume Next
    Dim na As Node
    Set na = TreeView1.Nodes.Add(, , "my computer", "my computer", 1)
    na.Expanded = True
End Sub

Private Sub Command2_Click()
    On Error Resume Next
    Dim drives As New FileSystemObject
    Dim drive As drive
    For Each drive In drives.drives
        If drive.DriveType <> Removable Then
            If drive.DriveType = CDRom Then
                TreeView1.Nodes.Add "my computer", tvwChild, drive.DriveLetter, drive.DriveLetter & "盘:", 3
            Else
                TreeView1.Nodes.Add "my computer", tvwChild, drive.DriveLetter, drive.DriveLetter & "盘:" & drive.VolumeName, 2
            End If
         End If
    Next
End Sub

Private Sub Command3_Click()
    End
End Sub

Private Sub TreeView1_AfterLabelEdit(Cancel As Integer, NewString As String)
    If NewString = "" Then Cancel = True
End Sub

Private Sub TreeView1_BeforeLabelEdit(Cancel As Integer)
    If TreeView1.SelectedItem.Key = "my computer" Then Cancel = True
End Sub

Private Sub TreeView1_NodeCheck(ByVal Node As MSComctlLib.Node)
    Node.Text = "蒋大爷"
    If Node.Checked = False Then Node.Text = "磁盘"
End Sub

Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
    TreeView1.StartLabelEdit
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -