📄 admini.frm
字号:
Caption = "还书"
Begin VB.Menu nor
Caption = "普通"
Shortcut = ^L
End
Begin VB.Menu accTime
Caption = "逾期"
Shortcut = ^O
End
End
Begin VB.Menu line2
Caption = "-"
End
Begin VB.Menu backup
Caption = "数据备份"
End
Begin VB.Menu deleteBac
Caption = "删除备份"
End
Begin VB.Menu line1
Caption = "-"
End
Begin VB.Menu exit
Caption = "退出"
Shortcut = ^X
End
End
Begin VB.Menu admin
Caption = "数据管理(D)"
Begin VB.Menu read
Caption = "借阅管理"
Shortcut = ^D
End
Begin VB.Menu sno
Caption = "学号管理"
Shortcut = ^E
End
Begin VB.Menu sb
Caption = "书号管理"
Shortcut = ^F
End
End
Begin VB.Menu search
Caption = "数据查询(S)"
Begin VB.Menu info
Caption = "借阅情况"
End
Begin VB.Menu book
Caption = "书库查询"
End
Begin VB.Menu name
Caption = "学号查询"
End
End
Begin VB.Menu set
Caption = "系统设置(T)"
Begin VB.Menu bg
Caption = "背景"
End
Begin VB.Menu font
Caption = "字体"
End
Begin VB.Menu Bset
Caption = "系统设置"
End
End
Begin VB.Menu help
Caption = "系统帮助(H)"
Begin VB.Menu title
Caption = "主题"
Shortcut = {F1}
End
Begin VB.Menu about
Caption = "关于"
Shortcut = ^A
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'-------------------------------------------------------------------'
'---本程序付新海版权所有仅供参考,并可自由使用,请勿用于商业用途。----'
'------学号:9735250,E-mail:fxh@astd.com.cn------'
'-----------地址:http://www.xhstudio.net-----------------'
'-------------------------------------------------------------------'
'listview1功能介绍:用于显示(当读者借书/还书时)该读者已借阅的所有书籍,方便管理员及读者了解信息
'adodc1功能介绍:与datagrid1绑定,显示数据查询信息
Private Sub about_Click()
Form3.Show
End Sub
'数据查询的实现
Private Sub begin_Click()
'对应不同的选项进行查询
On Error GoTo wrong
Dim LibName As String
If combo1.ListIndex = -1 Or Text1.Text = "" Then
MsgBox "你没有输入查询内容或选择查询项"
Else
a = Text1.Text
Adodc1.CommandType = adCmdText
i = combo1.ListIndex
b = combo1.List(i)
Set DataGrid1.DataSource = Adodc1
Select Case SSTab1.Tab
Case 2
If i <> 6 Then
Adodc1.RecordSource = "select * from libary where " & b & " like '%" & a & "%'" '借阅信息查询
Adodc1.Refresh
Else
Adodc1.RecordSource = "select * from libary "
Adodc1.Refresh
End If
Case 3
If i <> 7 Then
Adodc1.RecordSource = "select * from S_book where " & b & " like '%" & a & "%'" '书籍查询
Adodc1.Refresh
Else
Adodc1.RecordSource = "select * from S_book "
Adodc1.Refresh
End If
Case 4
If i <> 5 Then
Adodc1.RecordSource = "select * from S_no where " & b & " like '%" & a & "%'" '学号查询
Adodc1.Refresh
Else
Adodc1.RecordSource = "select * from S_no "
Adodc1.Refresh
End If
End Select
End If
L1.名称 = "共找到" & Adodc1.Recordset.RecordCount & "条记录"
Exit Sub
wrong:
MsgBox Err.Description
End Sub
Private Sub book_Click()
SSTab1.Tab = 3
With combo1
.Clear
.Text = "请选择类别"
.AddItem "名称", 0
.AddItem "作者", 1
.AddItem "书号", 2
.AddItem "名称", 3
.AddItem "出版社", 4
.AddItem "出版时间", 5
.AddItem "内容介绍", 6
.AddItem "所有记录", 7
End With
Adodc1.Refresh
End Sub
Private Sub Bset_Click()
Sets.Show
End Sub
Private Sub Combo2_Click()
Text1 = Combo2.Text
Combo2.Visible = False
End Sub
Private Sub Combo2_LostFocus()
Combo2.Visible = False
End Sub
Private Sub exit_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
frmSplash.Show
frmSplash.Refresh
Dim a1, a2
a1 = GetSetting("图书管理V1.0", "系统设置", "Btime", "Anonymous")
a2 = GetSetting("图书管理V1.0", "系统设置", "Ltime", "Anonymous")
If a1 = "Anonymous" Or a2 = "Anonymous" Then
SaveSetting "图书管理V1.0", "系统设置", "Btime", 2
SaveSetting "图书管理v1.0", "系统设置", "Ltime", 1
SaveSetting "图书管理v1.0", "系统设置", "Backup", 1
SaveSetting "图书管理v1.0", "系统设置", "Bcheck", 1
End If
begin.Enabled = False
Left = (Screen.Width - Width) \ 2
Top = (Screen.Height - Height) \ 2 '使窗体居中
ListView1.ColumnHeaderIcons = Me.ImageList1
ListView1.ColumnHeaders.Clear
ListView1.ColumnHeaders.Add , , "学号", ListView1.Width / 7
ListView1.ColumnHeaders.Add , , "书号", ListView1.Width / 7, , 1
ListView1.ColumnHeaders.Add , , "借书日期", ListView1.Width / 7
ListView1.ColumnHeaders.Add , , "还书日期", ListView1.Width / 7, , 1
ListView1.ColumnHeaders.Add , , "书籍名称", ListView1.Width / 7
ListView1.ColumnHeaders.Add , , "书籍介绍", ListView1.Width / 7
ListView1.ColumnHeaders.Add , , "目前状态", ListView1.Width / 7 '为listview1添加标题
If Not Form2.Data1.Recordset.EOF Then
Form2.Data1.Recordset.MoveLast
End If
begin.Picture = ImageList1.ListImages(4).Picture
For i = 1 To 6
DataGrid1.Columns.Add (i) '为了好看,给dbgrid添加标题
Next
Call ResizeInit(Me)
End Sub
Private Sub Form_Resize()
Call ResizeForm(Me) '窗体改变时,控件随之变化
Toolbar1.Top = (Frame1.Height - Toolbar1.Height + 80) / 2
Text1.Height = combo1.Height
combo1.Left = Text1.Left + Text1.Width + 60
combo1.Top = Text1.Top
With begin
.Left = combo1.Left + combo1.Width + 120
.Top = combo1.Top
.Height = combo1.Height
.Width = .Height '窗体改变时,调整combol1,beigin按钮的位置,combol1高度保持不变
End With
If Frame1.Top > 200 Then
Toolbar1.Top = Frame1.Top - 150
End If
End Sub
Private Sub Form_Unload(cancel As Integer)
'彻底卸载所有窗体并退出程序
Shutdown (True)
End Sub
'书籍管理
Private Sub info_Click()
SSTab1.Tab = 2
With combo1
.Clear
.Text = "请选择类别"
.AddItem "学号", 0
.AddItem "书号", 1
.AddItem "书籍名称", 2
.AddItem "借书日期", 3
.AddItem "还书日期", 4
.AddItem "书籍介绍", 5
.AddItem "所有记录", 6
End With
Adodc1.Refresh
End Sub
'学号管理
Private Sub name_Click()
SSTab1.Tab = 4
With combo1
.Clear
.Text = "请选择类别"
.AddItem "学号", 0
.AddItem "姓名", 1
.AddItem "性别", 2
.AddItem "专业", 3
.AddItem "学院", 4
.AddItem "所有记录", 5
End With
Adodc1.Refresh
End Sub
'还书
Private Sub nor_Click()
SSTab1.Tab = 1
Form2.Command3.Enabled = False
Form2.Caption = "还书"
Form2.Frame1.Caption = "还书"
Form2.Label3.Caption = "书号"
Form2.Label4.Caption = "确认"
Form2.Text9.Visible = False
Form2.Text10.Visible = False
Form2.Text7.Visible = True
Form2.Text8.Visible = True
Form2.Bor.Visible = False
Form2.Bak.Visible = True
Form2.Show
End Sub
'借书
Private Sub normal_Click()
SSTab1.Tab = 0
Form2.Text10.Visible = True
Form2.Text9.Visible = True
Form2.Text7.Visible = False
Form2.Text8.Visible = False
Form2.Bor.Visible = True
Form2.Bak.Visible = False
'得到借书日期和还书日期,由于时间关系,没有考虑闰年,及判断是否有30号
Dim a1 As Integer
a1 = GetSetting("图书管理V1.0", "系统设置", "Btime", "Anonymous")
Form2.Text11.Text = Year(Now()) & "年" & Month(Now()) & "月" & Day(Now()) & "日"
If Month(Now()) > 12 - a1 Then
Form2.Text12.Text = Year(Now()) + 1 & "年" & Month(Now()) + a1 - 12 & "月" & Day(Now()) & "日"
Else
Form2.Text12.Text = Year(Now()) & "年" & Month(Now()) + a1 & "月" & Day(Now()) & "日" '借书
End If
Form2.Show
BorrowFlag = True
End Sub
'书籍管理
Private Sub sb_Click()
sbook.Show
End Sub
'学号管理
Private Sub sno_Click()
S_admin.Show
End Sub
'续借
Private Sub special_Click()
SSTab1.Tab = 1
Form2.Command3.Enabled = False
Form2.Caption = "续借"
Form2.Frame1.Caption = "续借"
Form2.Label3.Caption = "书号"
Form2.Label4.Caption = "确认"
Form2.Text9.Visible = False
Form2.Text10.Visible = False
Form2.Text7.Visible = True
Form2.Text8.Visible = True
Form2.Bor.Visible = False
Form2.Bak.Visible = True
Form2.Command2.Visible = True
Form2.Show
Dim a1 As Integer
a1 = GetSetting("图书管理V1.0", "系统设置", "Ltime", "Anonymous")
Form2.Text11.Text = Year(Now()) & "年" & Month(Now()) & "月" & Day(Now()) & "日"
If Month(Now()) > 12 - a1 Then
Form2.Text12.Text = Year(Now()) + 1 & "年" & Month(Now()) - 12 + a1 & "月" & Day(Now()) & "日"
Else
Form2.Text12.Text = Year(Now()) & "年" & Month(Now()) + a1 & "月" & Day(Now()) & "日" '续借
End If
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
Select Case SSTab1.Tab
Case 2
info_Click
'即时更新adodc1的数据
Case 3
book_Click
Case 4
name_Click
End Select
End Sub
Private Sub SSTab1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Select Case SSTab1.Tab
Case 2
combo1.Enabled = True
combo1.Enabled = True
Text1.Enabled = True
begin.Enabled = True
DataGrid1.Visible = True
begin.Picture = ImageList1.ListImages(3).Picture
Case 3
combo1.Enabled = True
combo1.Enabled = True
Text1.Enabled = True
begin.Enabled = True
DataGrid1.Visible = True
begin.Picture = ImageList1.ListImages(3).Picture
Case 4
combo1.Enabled = True
combo1.Enabled = True
Text1.Enabled = True
begin.Enabled = True
DataGrid1.Visible = True
begin.Picture = ImageList1.ListImages(3).Picture
Case 0, 1
combo1.Enabled = False
combo1.Enabled = False
Text1.Enabled = False
begin.Enabled = False
DataGrid1.Visible = False
begin.Picture = ImageList1.ListImages(4).Picture '即时改变combol1,begin的状态,当切换到查询时有效
End Select
End Sub
Private Sub Text1_Click()
If combo1.Text = "性别" Then
With Combo2
.Left = Text1.Left
.Top = Text1.Top + Text1.Height
Combo2.Visible = True
Combo2.SetFocus
End With
End If
End Sub
Private Sub Timer1_Timer()
Unload frmSplash
Timer1.Enabled = False
End Sub
Private Sub title_Click()
Form3.Show
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Dim a1 As Integer
a1 = GetSetting("图书管理V1.0", "系统设置", "Bcheck", "Anonymous") '得到系统设置信息
Select Case Button.Index
Case 1
If a1 = 1 Then
PopupMenu Me.borrow, vbPopupMenuLeftAlign, Button.Left + 150, Button.Top + Button.Height + 150 '弹出选择菜单
Else
normal_Click
End If
Case 2
nor_Click
Case 3
If a1 = 1 Then
PopupMenu Me.search, vbPopupMenuLeftAlign, Button.Left + 150, Button.Top + Button.Height + 150 '弹出选择菜单
End If
Case 4
S_admin.Show
Case 5
sbook.Show
Case 6
Sets.Show
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -