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

📄 formsys.frm

📁 图书管理系统。本图书管理系统具有查询
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Height          =   240
            Index           =   1
            Left            =   2400
            TabIndex        =   34
            Top             =   300
            Width           =   1560
         End
         Begin VB.CheckBox Check1 
            Caption         =   "数据库文件"
            Height          =   240
            Index           =   0
            Left            =   480
            TabIndex        =   33
            Top             =   330
            Width           =   1245
         End
      End
      Begin VB.Frame Frame1 
         Caption         =   "选择备份文件存放路径"
         Height          =   750
         Left            =   -74850
         TabIndex        =   1
         Top             =   480
         Width           =   4260
         Begin VB.CommandButton Command1 
            Caption         =   "浏览"
            Height          =   285
            Left            =   3390
            TabIndex        =   3
            Top             =   285
            Width           =   735
         End
         Begin VB.TextBox Textpath 
            Height          =   285
            Left            =   135
            TabIndex        =   2
            Top             =   300
            Width           =   3135
         End
      End
      Begin VB.Label Label9 
         Caption         =   "(设置后点确定有效)"
         Height          =   255
         Left            =   2580
         TabIndex        =   30
         Top             =   525
         Width           =   1665
      End
      Begin VB.Label Label5 
         Caption         =   "输入密码才能进入系统"
         Height          =   210
         Left            =   525
         TabIndex        =   17
         Top             =   675
         Width           =   1815
      End
      Begin VB.Label Label4 
         Caption         =   "启动时不需要输入密码"
         Height          =   225
         Left            =   525
         TabIndex        =   14
         Top             =   435
         Width           =   1890
      End
      Begin VB.Label Label3 
         Caption         =   "启动窗体状态"
         Height          =   270
         Left            =   -74685
         TabIndex        =   13
         Top             =   1800
         Width           =   1155
      End
      Begin VB.Label Label2 
         Caption         =   "加入单位名称"
         Height          =   240
         Left            =   -74700
         TabIndex        =   9
         Top             =   1200
         Width           =   1080
      End
      Begin VB.Label Label1 
         Caption         =   "窗格背景颜色"
         Height          =   180
         Left            =   -74700
         TabIndex        =   6
         Top             =   675
         Width           =   1110
      End
   End
End
Attribute VB_Name = "Formsys"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


'*********************************
              '系统设置窗体
'*********************************
'所调用的API函数,自定义过程,类型,常数请参阅相应模块



Option Explicit


'通用过程,设置一个文件对象
Private Sub fileobj(filepath As String, newpath As String)
    Dim fs, f
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(filepath)
    f.Copy newpath
End Sub

'备份文件
Private Sub Cmdback_Click()
On Error GoTo wrong
If Textpath.Text = "" Then
    MsgBox "请选择备份文件存放路径"
    Exit Sub
Else
    Dim ifchange As Boolean
    ifchange = False
    If Check1(0).Value = 1 Then  '备份数据库文件
        fileobj App.Path & "\library.mdb", Textpath.Text & "\mdbbak"
        ifchange = True
    End If
    If Check1(1).Value = 1 Then  '备份系统配置文件
        fileobj App.Path & "\config.ini", Textpath.Text & "\cfgbak"
        ifchange = True
    End If
    If ifchange Then
    MsgBox "文件备份成功。"
    Else
    MsgBox "请选择文件"
    End If
    Exit Sub
End If
wrong:     '错误处理
MsgBox Err.Description & ",备份失败。"
Exit Sub
End Sub
'选择备份文件夹
Private Sub Command1_Click()
Dim oldpath As String
oldpath = Textpath.Text
Dim backpath As BrowseInfo
Textpath.Text = BrowseForFolder(backpath.hWndOwner, "选择备份文件夹")
If Textpath.Text = "" Then Textpath.Text = oldpath
End Sub
'文件恢复
Private Sub Command2_Click()
On Error GoTo wrong
If Textpath.Text = "" Then
    MsgBox "请选择备份文件存放路径"
    Exit Sub
Else
    Dim ifchange As Boolean
    ifchange = False
        If Check1(0).Value = 1 Then
        fileobj Textpath.Text & "\mdbbak", App.Path & "\library.mdb"
        ifchange = True
    End If
    If Check1(1).Value = 1 Then
        fileobj Textpath.Text & "\cfgbak", App.Path & "\config.ini"
        ifchange = True
    End If
    If ifchange Then
        MsgBox "文件恢复成功。"
    Else
        MsgBox "请选择文件"
    End If
End If
Exit Sub
wrong:
MsgBox Err.Description & ",恢复失败。"
Exit Sub
End Sub

Private Sub Command3_Click()
Unload Me
End Sub
'系统设置
'选择窗体表格背景颜色
Private Sub Command4_Click()
ComDialog.Color = Text1.BackColor
ComDialog.ShowColor

Text1.BackColor = ComDialog.Color
End Sub

Private Sub Command5_Click()
Formmain.DataGrid1.BackColor = Text1.BackColor '改变背景色
If Formmain.ListView1.Visible = True Then Formmain.ListView1.BackColor = Text1.BackColor
Formmain.Caption = Text2.Text & "图书管理系统"   '窗体标题
writeini "system", "dgridcolor", CStr(Text1.BackColor)   '写入配置文件
writeini "system", "formcaption", Text2.Text

Dim i As Integer
For i = 0 To 2                                    '窗体启动选项
If Option1(i) = True Then
writeini "system", "winstate", CStr(i)
Exit For
End If
Next i

End Sub

Private Sub Command6_Click()
Unload Me
End Sub
'管理选项,主要是密码设置,有效密码为3-10位字符
Private Sub Command7_Click()
If Option2(0).Value = True Then
writeini "option", "ifpassword", "0"
MsgBox "已经设置为无密码启动"
writeini "option", "password", ""
Else
If Text3.Text = "" Or Text4.Text = "" Then
MsgBox "请输入密码并确认"
ElseIf 10 < Len(Text3.Text) Or Len(Text3.Text) < 3 Or Left(Text3.Text, 1) = "" Or Right(Text3.Text, 1) = "" Then
MsgBox "密码无效"
Exit Sub
ElseIf Text3.Text <> Text4.Text Then
MsgBox "两次输入不一致,请检查。"
Exit Sub
Else
writeini "option", "ifpassword", "1"
writeini "option", "password", Text3.Text
MsgBox "密码设置成功"
End If
End If
End Sub

Private Sub Command8_Click()
Unload Me
End Sub
'窗体加载时读取各项设置并显示
Private Sub Form_Load()
Dim i As Long
Textpath.Text = App.Path & "\backup"
Text1.BackColor = Formmain.DataGrid1.BackColor
Text2.Text = getinistr("system", "formcaption")
i = getininum("system", "winstate")
Option1(i).Value = True
i = getininum("option", "ifpassword")
Option2(i).Value = True
If Option2(1).Value = True Then
Text3.Text = getinistr("option", "password")
Text4.Text = Text3.Text
Else
Text3.Text = ""
Text4.Text = ""
End If
End Sub
'控件属性控制
Private Sub Option2_Click(Index As Integer)
Select Case Option2(1).Value
Case True
Frame3.Enabled = True
Text3.Enabled = Frame3.Enabled
Text4.Enabled = Frame3.Enabled
Label6.Enabled = Frame3.Enabled
Label7.Enabled = Frame3.Enabled
Label8.Enabled = Frame3.Enabled
If Option2(1).Value = True Then
Text3.Text = getinistr("option", "password")
Text4.Text = Text3.Text
End If
Case False
Frame3.Enabled = False
Text3.Enabled = Frame3.Enabled
Text4.Enabled = Frame3.Enabled
Label6.Enabled = Frame3.Enabled
Label7.Enabled = Frame3.Enabled
Label8.Enabled = Frame3.Enabled
Text3.Text = ""
Text4.Text = ""
End Select
End Sub

⌨️ 快捷键说明

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