📄 frm_login.frm
字号:
VERSION 5.00
Object = "{57EA6131-FAB3-49C3-BF10-85A4777A5A7C}#1.0#0"; "XPButton.ocx"
Begin VB.Form frm_login
BorderStyle = 0 'None
Caption = "登录"
ClientHeight = 2730
ClientLeft = 2790
ClientTop = 3150
ClientWidth = 4860
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 182
ScaleMode = 3 'Pixel
ScaleWidth = 324
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin XP_Button.XPButton cmdcancel
Height = 360
Left = 2790
TabIndex = 3
Top = 1770
Width = 1230
_ExtentX = 2170
_ExtentY = 635
caption = "取消"
End
Begin XP_Button.XPButton cmdok
Height = 390
Left = 615
TabIndex = 2
Top = 1770
Width = 1275
_ExtentX = 2249
_ExtentY = 688
caption = "确定"
End
Begin VB.TextBox txtUserID
Height = 345
Left = 1695
MaxLength = 6
TabIndex = 0
Top = 780
Width = 2325
End
Begin VB.TextBox txtPassword
Height = 345
IMEMode = 3 'DISABLE
Left = 1695
MaxLength = 6
PasswordChar = "*"
TabIndex = 1
Top = 1275
Width = 2325
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "登录"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000E&
Height = 360
Left = 465
TabIndex = 6
Top = 75
Width = 720
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用户编号:"
Height = 270
Index = 0
Left = 465
TabIndex = 4
Top = 840
Width = 1080
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用户密码:"
Height = 270
Index = 1
Left = 450
TabIndex = 5
Top = 1335
Width = 1080
End
Begin VB.Image imglefttitle
Height = 450
Left = 0
Picture = "frm_login.frx":0000
Top = 0
Width = 450
End
Begin VB.Image imgleftbottom
Height = 450
Left = 15
Picture = "frm_login.frx":0B0A
Top = 2250
Width = 450
End
Begin VB.Image imgrightbottom
Height = 450
Left = 4380
Picture = "frm_login.frx":1614
Top = 2250
Width = 450
End
Begin VB.Image imgbottom
Height = 450
Left = 450
Picture = "frm_login.frx":211E
Stretch = -1 'True
Top = 2250
Width = 3960
End
Begin VB.Image imgrightwindow
Height = 1935
Left = 4380
Picture = "frm_login.frx":8A60
Stretch = -1 'True
Top = 420
Width = 450
End
Begin VB.Image imgleftwindow
Height = 1860
Left = 30
Picture = "frm_login.frx":CD7A
Stretch = -1 'True
Top = 420
Width = 465
End
Begin VB.Image imgclose
Height = 240
Left = 4545
Picture = "frm_login.frx":1032C
Top = 45
Width = 240
End
Begin VB.Image imgrighttitle
Height = 525
Left = 4455
Picture = "frm_login.frx":1066E
Top = -75
Width = 375
End
Begin VB.Image imgtop
Height = 450
Left = 255
Picture = "frm_login.frx":11114
Stretch = -1 'True
Top = -15
Width = 4215
End
End
Attribute VB_Name = "frm_login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim MyLogin As Cls_user
Private Sub cmdCancel_Click()
End
End Sub
Private Sub cmdOK_Click()
'根据用户名和密码调用Cls_user类中的方法
Dim UserActor As String
Set MyLogin = New Cls_user
MyLogin.Query_user Trim(txtUserID)
If MyLogin.GetUserByIDRs.EOF = False Then
'将用户角色赋给公共变量UserName
UserID = Trim(MyLogin.GetUserByIDRs.Fields(0))
UserActor = Trim(MyLogin.GetUserByIDRs.Fields(3))
If txtPassword = Trim(MyLogin.GetUserByIDRs.Fields(2)) Then
frm_main.Show
Select Case UserActor
Case "咨询师"
SetQuanXian 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Case "财务"
SetQuanXian 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Case "教员"
SetQuanXian 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0
Case "教务主管"
SetQuanXian 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0
Case "总监"
SetQuanXian 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1
End Select
Unload Me
Else
MsgBox "密码错误!请重新输入!"
txtPassword = ""
txtPassword.SetFocus
End If
Else
MsgBox "非法用户! "
txtUserID = ""
txtPassword = ""
txtUserID.SetFocus
End If
End Sub
Private Sub Form_Activate()
txtUserID.SetFocus
End Sub
Private Sub Form_Load()
SetWindow Me
AlwaysOnTop Me, False
End Sub
Private Sub imgclose_Click()
Unload Me
End Sub
Private Sub imglefttitle_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawForms Me
End Sub
Private Sub imgtop_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawForms Me
End Sub
Private Sub imgrighttitle_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawForms Me
End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And txtPassword <> "" Then cmdOK_Click
End Sub
Private Sub txtUserID_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And txtUserID <> "" Then
txtPassword.SetFocus
End If
End Sub
Private Function SetQuanXian(a As Integer, b As Integer, c As Integer, d As Integer, e As Integer, f As Integer, g As Integer, h As Integer, i As Integer, j As Integer, k As Integer, l As Integer, m As Integer)
With frm_main
.mnu_addnewstudent.Enabled = a
.mnu_setfee.Enabled = b
.mnu_setcourse.Enabled = c
.mnu_setclass.Enabled = d
.mnu_enterforexam.Enabled = e
.mnu_addmark.Enabled = f
.mnu_statmark.Enabled = g
.mnu_setstatus.Enabled = h
.mnu_showrisepictrue.Enabled = i
.mnu_stdmsgrpt.Enabled = j
.meu_stdexmrpt.Enabled = k
.mnu_stdmarkrpt.Enabled = l
.mnu_setsystemparam.Enabled = m
End With
With frm_menu
.Image1(0).Enabled = a
.Image1(1).Enabled = b
.Image1(2).Enabled = c
.Image1(3).Enabled = d
.Image1(4).Enabled = e
.Image1(5).Enabled = f
.Image1(6).Enabled = g
.Image1(7).Enabled = h
.Image1(8).Enabled = i
.Image1(9).Enabled = j
.Image1(10).Enabled = k
.Image1(11).Enabled = l
.Image1(12).Enabled = m
End With
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -