📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{CE671F01-259E-40DA-92FE-95803E2ECBB5}#1.0#0"; "SmartXPButton.ocx"
Begin VB.Form FrmLogin
BackColor = &H00E7DFE7&
BorderStyle = 0 'None
Caption = "登录"
ClientHeight = 3885
ClientLeft = 0
ClientTop = 0
ClientWidth = 4755
ClipControls = 0 'False
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3885
ScaleWidth = 4755
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtUserID
Height = 360
IMEMode = 3 'DISABLE
Left = 2160
TabIndex = 1
Top = 1080
Width = 2295
End
Begin VB.TextBox txtUserName
BackColor = &H00E7DFE7&
Height = 360
Left = 2160
Locked = -1 'True
TabIndex = 7
TabStop = 0 'False
Top = 1800
Width = 2295
End
Begin VB.TextBox txtPass
Height = 360
IMEMode = 3 'DISABLE
Left = 2160
MaxLength = 12
PasswordChar = "*"
TabIndex = 3
Top = 2565
Width = 2295
End
Begin SmartXPButton.XpButton cmdCancel
Cancel = -1 'True
Height = 495
Left = 2760
TabIndex = 5
Top = 3240
Width = 1335
_ExtentX = 2355
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
CaptionAreaPercent= 100
Caption = "取消(&C)"
CaptionMouseOverColor= 16711680
PictureSmoothBackColor= 14410727
End
Begin SmartXPButton.XpButton cmdOK
Height = 495
Left = 1080
TabIndex = 4
Top = 3240
Width = 1335
_ExtentX = 2355
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
CaptionAreaPercent= 100
Caption = "确定(&O)"
CaptionMouseOverColor= 16711680
PictureSmoothBackColor= 14410727
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户编号(&I):"
Height = 180
Left = 960
TabIndex = 0
Top = 1200
Width = 1170
End
Begin VB.Image Image3
Height = 870
Left = 0
Picture = "FrmLogin.frx":0000
Top = 0
Width = 4770
End
Begin VB.Image Image2
Height = 480
Left = 240
Picture = "FrmLogin.frx":0B44
Stretch = -1 'True
Top = 2505
Width = 480
End
Begin VB.Image Image1
Height = 480
Left = 240
Picture = "FrmLogin.frx":24C6
Stretch = -1 'True
Top = 1185
Width = 480
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码(&P):"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Index = 1
Left = 960
TabIndex = 2
Top = 2640
Width = 840
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Index = 0
Left = 960
TabIndex = 6
Top = 1920
Width = 735
End
End
Attribute VB_Name = "FrmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MyLogin As OpenRs
Dim UseridSQL As String
Dim Level As Integer
Public CurrentUser As String
Private Sub Cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
If txtUserId.Text = "Administrator" And txtPass.Text = "ACCP2002" Then
Unload Me
FrmMain.Show
Exit Sub
End If
If txtUserId.Text = "" Then
MsgBox "请输入用户编号!", vbOKOnly + vbInformation, "用户登陆"
txtUserId.SetFocus
Exit Sub
Else
UseridSQL = "select * from User_Info where user_Id='" & txtUserId.Text & "'"
MyLogin.rsDK1 UseridSQL
If MyLogin.rs1.EOF = False Then
txtUserName.Text = Trim(MyLogin.rs1!user_name)
Level = MyLogin.rs1!user_level
If txtPass.Text = Trim(MyLogin.rs1!user_pwd) Then
CurrentUser = Trim(MyLogin.rs1!user_name)
Call DisplayMenu
Unload Me
FrmMain.Show
Else
MsgBox "密码错误!" & vbCrLf & vbCrLf & "请重新输入!", vbOKOnly + vbInformation, "用户登陆"
txtPass.Text = ""
txtPass.SetFocus
Exit Sub
End If
Else
MsgBox "用户编号不存在!" & vbCrLf & vbCrLf & "请重新输入!", vbOKOnly + vbInformation, "用户登陆"
txtUserId.Text = ""
txtUserId.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub Form_Load()
Set MyLogin = New OpenRs
End Sub
Private Sub txtPass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call cmdOK_Click
End If
End Sub
Private Sub txtUserId_Change()
txtPass.Text = ""
txtUserName.Text = ""
End Sub
Private Sub txtUserId_KeyPress(KeyAscii As Integer)
If KeyAscii = 39 Then
KeyAscii = 0
ElseIf KeyAscii = 13 Then
txtPass.SetFocus
End If
End Sub
Private Sub txtUserId_LostFocus()
UseridSQL = "select * from User_Info where user_Id='" & txtUserId.Text & "'"
MyLogin.rsDK1 UseridSQL
If MyLogin.rs1.EOF = False Then
txtUserName.Text = Trim(MyLogin.rs1!user_name)
End If
End Sub
Private Sub DisplayMenu()
If Level = 2 Then
FrmMain.mnuBackUpDB.Visible = False
FrmMain.mnuRestoreDB.Visible = False
FrmMain.mnuline1.Visible = False
FrmMain.mnuAddUser.Visible = False
FrmMain.mnuDeleteUser.Visible = False
ElseIf Level = 3 Then
FrmMain.mnuBackUpDB.Visible = False
FrmMain.mnuRestoreDB.Visible = False
FrmMain.mnuline1.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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -