📄 backup2.frm
字号:
VERSION 5.00
Begin VB.Form Backup2
BorderStyle = 1 'Fixed Single
Caption = "请选择文件供备份"
ClientHeight = 3870
ClientLeft = 45
ClientTop = 330
ClientWidth = 5415
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3870
ScaleWidth = 5415
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame1
Caption = "备份什么"
Height = 1095
Left = 240
TabIndex = 10
Top = 2640
Width = 3615
Begin VB.CheckBox Check3
Caption = "光盘镜像注册表"
Height = 255
Left = 120
TabIndex = 13
Top = 720
Width = 2175
End
Begin VB.CheckBox Check2
Caption = "所有搜索结果"
Height = 255
Left = 120
TabIndex = 12
Top = 480
Width = 1455
End
Begin VB.CheckBox Check1
Caption = "所有光盘镜像"
Height = 255
Left = 120
TabIndex = 11
Top = 240
Width = 1455
End
End
Begin VB.CommandButton Command7
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 4080
TabIndex = 7
Top = 3240
Width = 1095
End
Begin VB.CommandButton Command6
Caption = "开始"
Default = -1 'True
Height = 375
Left = 4080
TabIndex = 6
Top = 2760
Width = 1095
End
Begin VB.CommandButton RightMove
Height = 375
Left = 2400
Picture = "backup2.frx":0000
Style = 1 'Graphical
TabIndex = 5
ToolTipText = "选定文件到备份框中"
Top = 600
Width = 615
End
Begin VB.CommandButton RightAll
Height = 375
Left = 2400
Picture = "backup2.frx":0442
Style = 1 'Graphical
TabIndex = 4
ToolTipText = "全部选定文件供备份"
Top = 1560
Width = 615
End
Begin VB.CommandButton LeftAll
Height = 375
Left = 2400
Picture = "backup2.frx":0594
Style = 1 'Graphical
TabIndex = 3
ToolTipText = "移走全部要备份的文件"
Top = 2040
Width = 615
End
Begin VB.CommandButton LeftMove
Height = 375
Left = 2400
Picture = "backup2.frx":06E6
Style = 1 'Graphical
TabIndex = 2
ToolTipText = "移走备份文件"
Top = 1080
Width = 615
End
Begin VB.ListBox List2
Height = 2220
Left = 3120
MultiSelect = 2 'Extended
TabIndex = 1
Top = 360
Width = 2055
End
Begin VB.ListBox List1
Height = 2220
Left = 240
MultiSelect = 2 'Extended
TabIndex = 0
Top = 360
Width = 2055
End
Begin VB.Label Label2
Caption = "要备份的文件"
Height = 255
Left = 3120
TabIndex = 9
Top = 120
Width = 2055
End
Begin VB.Label Label1
Caption = "已有的文件"
Height = 255
Left = 240
TabIndex = 8
Top = 120
Width = 2055
End
End
Attribute VB_Name = "Backup2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
If Check1.Value Then
For i = List1.ListCount - 1 To 0 Step -1
If Right(List1.List(i), 3) = "cdo" Then
List2.AddItem List1.List(i)
List1.RemoveItem i
End If
Next
Else
For i = List2.ListCount - 1 To 0 Step -1
If Right(List2.List(i), 3) = "cdo" Then
List1.AddItem List2.List(i)
List2.RemoveItem i
End If
Next
End If
If List1.ListCount = 0 Then
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = False
RightAll.Enabled = False
Exit Sub
End If
If List2.ListCount = 0 Then
LeftMove.Enabled = False
LeftAll.Enabled = False
RightMove.Enabled = True
RightAll.Enabled = True
Else
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = True
RightAll.Enabled = True
End If
End Sub
Private Sub Check2_Click()
If Check2.Value Then
For i = List1.ListCount - 1 To 0 Step -1
If Right(List1.List(i), 3) = "fnd" Then
List2.AddItem List1.List(i)
List1.RemoveItem i
End If
Next
Else
For i = List2.ListCount - 1 To 0 Step -1
If Right(List2.List(i), 3) = "fnd" Then
List1.AddItem List2.List(i)
List2.RemoveItem i
End If
Next
End If
If List1.ListCount = 0 Then
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = False
RightAll.Enabled = False
Exit Sub
End If
If List2.ListCount = 0 Then
LeftMove.Enabled = False
LeftAll.Enabled = False
RightMove.Enabled = True
RightAll.Enabled = True
Else
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = True
RightAll.Enabled = True
End If
End Sub
Private Sub Check3_Click()
If Check3.Value Then
For i = List1.ListCount - 1 To 0 Step -1
If List1.List(i) = "cdrom.cds" Then
List2.AddItem List1.List(i)
List1.RemoveItem i
End If
Next
Else
For i = List2.ListCount - 1 To 0 Step -1
If List2.List(i) = "cdrom.cds" Then
List1.AddItem List2.List(i)
List2.RemoveItem i
End If
Next
End If
If List1.ListCount = 0 Then
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = False
RightAll.Enabled = False
Exit Sub
End If
If List2.ListCount = 0 Then
LeftMove.Enabled = False
LeftAll.Enabled = False
RightMove.Enabled = True
RightAll.Enabled = True
Else
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = True
RightAll.Enabled = True
End If
End Sub
Private Sub Command1_Click()
For i = List2.ListCount - 1 To 0 Step -1
If List2.Selected(i) Then
List1.AddItem List2.List(i)
List2.RemoveItem i
End If
Next
If List2.ListCount > 0 Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = True
Command5.Enabled = True
End If
If List1.ListCount = 0 Then
Command3.Enabled = False
Command5.Enabled = False
End If
End Sub
Private Sub Command5_Click()
End Sub
Private Sub Command6_Click()
If List2.ListCount = 0 Then
MsgBox "没有文件供备份!", vbExclamation
Exit Sub
End If
num = List2.ListCount
ReDim BackupFileArray(1 To num) As String
For i = 1 To num
BackupFileArray(i) = List2.List(i - 1)
Next
Unload Me
Load Backup
Backup.Show vbModal
End Sub
Private Sub Command7_Click()
Unload Me
End Sub
Private Sub Form_Load()
CencerForm Me
Dim fs As New Scripting.FileSystemObject
Dim fd As Folder, sf As File
Set fd = fs.GetFolder(App.Path)
For Each sf In fd.Files
If sf.Name = "cdrom.cds" Then
List1.AddItem sf.Name
End If
If Right(sf.Name, 3) = "cdo" Then
List1.AddItem sf.Name
End If
If Right(sf.Name, 3) = "fnd" Then
List1.AddItem sf.Name
End If
Next
LeftMove.Enabled = False
LeftAll.Enabled = False
If List1.ListCount > 1 Then
List1.ListIndex = 0
End If
End Sub
Private Sub LeftAll_Click()
List1.Clear
For i = List2.ListCount - 1 To 0 Step -1
For j = 0 To List1.ListCount - 1
If List1.List(j) = List2.List(i) Then
j = 99999
Exit For
End If
Next
If j < 99999 Then
List1.AddItem List2.List(i)
End If
Next
List2.Clear
LeftMove.Enabled = False
LeftAll.Enabled = False
RightAll.Enabled = True
RightMove.Enabled = True
End Sub
Private Sub LeftMove_Click()
For i = List2.ListCount - 1 To 0 Step -1
If List2.Selected(i) Then
List1.AddItem List2.List(i)
List2.RemoveItem i
End If
Next
If List1.ListCount = 0 Then
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = False
RightAll.Enabled = False
Exit Sub
End If
If List2.ListCount = 0 Then
LeftMove.Enabled = False
LeftAll.Enabled = False
RightMove.Enabled = True
RightAll.Enabled = True
Else
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = True
RightAll.Enabled = True
End If
End Sub
Private Sub List1_Click()
List1.ToolTipText = List1.List(List1.ListIndex)
End Sub
Private Sub List1_DblClick()
RightMove_Click
End Sub
Private Sub List2_Click()
List2.ToolTipText = List2.List(List2.ListIndex)
End Sub
Private Sub List2_DblClick()
LeftMove_Click
End Sub
Private Sub RightAll_Click()
For i = List1.ListCount - 1 To 0 Step -1
For j = 0 To List2.ListCount - 1
If List2.List(j) = List1.List(i) Then
j = 99999
Exit For
End If
Next
If j < 99999 Then
List2.AddItem List1.List(i)
End If
Next
List1.Clear
RightMove.Enabled = False
RightAll.Enabled = False
LeftAll.Enabled = True
LeftMove.Enabled = True
End Sub
Private Sub RightMove_Click()
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) Then
List2.AddItem List1.List(i)
List1.RemoveItem i
End If
Next
If List1.ListCount = 0 Then
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = False
RightAll.Enabled = False
Exit Sub
End If
If List2.ListCount = 0 Then
LeftMove.Enabled = False
LeftAll.Enabled = False
RightMove.Enabled = True
RightAll.Enabled = True
Else
LeftMove.Enabled = True
LeftAll.Enabled = True
RightMove.Enabled = True
RightAll.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -