Private Sub DisplayMenu() ’ 设置用户不同等级的访问权限,不够等级隐藏
If Level = 2 Then
FrmMain.mnuBackUpDB.Visible = False
FrmMain.mnuRestoreDB.Visible = False
FrmMain.mnuAddUser.Visible = False
FrmMain.mnuDeleteUser.Visible = False
ElseIf Level = 3 Then
FrmMain.mnuBackUpDB.Visible = False
FrmMain.mnuRestoreDB.Visible = False
FrmMain.mnuUserManage.Visible = False
FrmMain.mnuGrade.Visible = False
FrmMain.mnuClass.Visible = False
FrmMain.mnuCourseInfo.Visible = False
FrmMain.mnuStudentInfo.Visible = False
FrmMain.mnuResult.Visible = False
End If
End Sub
5.3 系统主界面及代码设计
5.3.1系统主界面
用户登录后,将进入系统主界面,如下图:
图5-3 系统主界面
5.3.2系统主界面代码设计
系统主界面实现的代码设计如下:
Dim Myinfo As String ’定义变量
Dim success As Long
Private Declare Function htmlhelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal hwndCaller As Long, ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Long) As Long
Private Sub MDIForm_Load()
Set Classprint = New OpenRs ’调用类函数
Timer1.Enabled = True
Dim mypanel As Panel
Set mypanel = StatusBar1.Panels.Add(1, , , sbrDate) '状态栏1显示日期
Set mypanel = StatusBar1.Panels.Add(2) '状态栏2显示星期几
Call MyWeekDay
Set mypanel = StatusBar1.Panels.Add(3)
StatusBar1.Panels(3).Text = "当前用户:" & FrmLogin.CurrentUser
mypanel.AutoSize = sbrContents
Set mypanel = StatusBar1.Panels.Add(4) '状态栏3显示文本消息
mypanel.AutoSize = sbrSpring
End Sub
Private Sub mnuAbout_Click() ’设置说明
ShellAbout Me.hwnd, "员工培训管理系统 第7页", "版权所有(C)2005.6" & vbCrLf & "开发:yeao", Me.Icon
End Sub
Private Sub mnuAddResult_Click() ’以下定义菜单点击触发各模块
Frmresult.Show
End Sub
Private Sub mnuClassQuery_Click()
FrmClassQuery.Show
End Sub
Private Sub mnuCourseQuery_Click()
FrmCourseQuery.Show
End Sub
Private Sub mnuResultQuery_Click()
FrmResultQuery.Show
End Sub
Private Sub mnuSchoolSet_Click()
FrmSchoolInfo.Show
End Sub
Private Sub mnuSetClass_Click()
FrmClassInfo.Show
End Sub
Private Sub mnuAddStudentInfo_Click()
FrmAddStudentInfo.Show
End Sub
Private Sub mnuAddUser_Click()
FrmAddUser.Show
End Sub
Private Sub mnuBackUpDB_Click()
FrmBackUp.Show
End Sub
Private Sub mnuDeleteUser_Click()
FrmDelUser.Show
End Sub
Private Sub mnuModiPwd_Click()
FrmModiPass.Show
End Sub
Private Sub mnuExit_Click() ’设置退出系统
If MsgBox("要退出系统吗?", vbYesNo + vbInformation, "退出") = vbYes Then
Unload FrmMain
End If
End Sub
Private Sub mnuLogoff_Click() ’ 设置注销系统
If MsgBox("要注销系统吗?", vbYesNo + vbInformation, "注销") = vbYes Then
Unload FrmMain
FrmLogin.Show
End If
End Sub
Private Sub mnuRestoreDB_Click()
If MsgBox("是否现在就执行还原数据库的操作?", vbYesNo + vbInformation, "还原数据库") = vbYes Then
success = WritePrivateProfileString("BackUp", "Restore", "True", App.Path & "\备份.ini")
Unload Me
Shell "Restore.exe"
End If
End Sub
Private Sub mnuSetCourse_Click()
FrmGradecourse.Show
End Sub
Private Sub mnuSetCourseInfo_Click()
FrmCourse.Show
End Sub
Private Sub mnuSetGrade_Click()
FrmGradeInfo.Show
End Sub
Private Sub mnuStudentQuery_Click()
FrmStuInfoQuery.Show
End Sub
Private Sub Timer1_Timer() ’状态栏移动的欢迎辞
If Myinfo = "" Then
Myinfo = Space(85) & "欢迎使用员工培训管理系统 第7页!"
End If
Myinfo = Right(Myinfo, Len(Myinfo) - 1)
StatusBar1.Panels(4).Text = Myinfo
End Sub
Private Sub MyWeekDay() ’定义显示日期函数
Select Case Weekday(Date)
Case 1
StatusBar1.Panels(2).Text = "星期日"
Case 2
StatusBar1.Panels(2).Text = "星期一"
Case 3
StatusBar1.Panels(2).Text = "星期二"
Case 4
StatusBar1.Panels(2).Text = "星期三"
Case 5
StatusBar1.Panels(2).Text = "星期四"
Case 6
StatusBar1.Panels(2).Text = "星期五"
Case 7
StatusBar1.Panels(2).Text = "星期辣"
End Select
End Sub
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>