📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form Frmlogin
BorderStyle = 1 'Fixed Single
Caption = "登录"
ClientHeight = 3300
ClientLeft = 45
ClientTop = 330
ClientWidth = 3675
ControlBox = 0 'False
Icon = "Frmlogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3300
ScaleWidth = 3675
StartUpPosition = 1 '所有者中心
Begin VB.PictureBox StatusBar1
Align = 2 'Align Bottom
Height = 330
Left = 0
ScaleHeight = 270
ScaleWidth = 3615
TabIndex = 10
Top = 2970
Width = 3675
End
Begin VB.Frame Frame3
Caption = "用户类型"
Height = 1095
Left = 0
TabIndex = 7
Top = 45
Width = 3660
Begin VB.OptionButton Option1
Caption = "管理员(限制了一些操作)"
Height = 180
Index = 1
Left = 270
TabIndex = 9
Top = 630
Width = 3255
End
Begin VB.OptionButton Option1
Caption = "系统管理员(拥有所有操作权限)"
Height = 180
Index = 0
Left = 270
TabIndex = 8
Top = 270
Value = -1 'True
Width = 3255
End
End
Begin VB.Frame Frame2
Caption = "用户登录"
Height = 1815
Left = 0
TabIndex = 0
Top = 1170
Width = 3660
Begin VB.CommandButton Command1
Caption = "登录"
Default = -1 'True
Height = 375
Index = 0
Left = 1800
TabIndex = 4
Top = 1260
Width = 780
End
Begin VB.TextBox Text1
Height = 375
IMEMode = 3 'DISABLE
Index = 1
Left = 1215
PasswordChar = "*"
TabIndex = 3
Top = 765
Width = 2130
End
Begin VB.TextBox Text1
Height = 375
Index = 0
Left = 1215
TabIndex = 2
Top = 315
Width = 2130
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "退出"
Height = 375
Index = 1
Left = 2610
TabIndex = 1
Top = 1260
Width = 780
End
Begin VB.Label Label1
Caption = "密码:"
Height = 330
Index = 1
Left = 405
TabIndex = 6
Top = 855
Width = 1230
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 375
Index = 0
Left = 405
TabIndex = 5
Top = 405
Width = 1275
End
End
End
Attribute VB_Name = "Frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Rs As ADODB.Recordset
Private UT As Integer
Public TWForm As New TransWindow
Private Sub Command1_Click(Index As Integer)
Dim Msg$
Dim SQL$
Select Case Index
Case 0
If Text1(0).Text = Empty Then
MsgBox "请输入用户名", vbInformation, "登录失败"
Text1(0).SetFocus
Exit Sub
End If
If Text1(1).Text = Empty Then
MsgBox "请输入用户密码", vbInformation, "登录失败"
Text1(1).SetFocus
Exit Sub
End If
StatusBar1.Panels(1).Text = "登录中..."
Text1(0).Enabled = False
Text1(1).Enabled = False
Option1(0).Enabled = False
Option1(1).Enabled = False
DBName = UserDB
SQL = "select * from UserInfo where UserName='" & Text1(0).Text & "'"
Set Rs = executeSQL(SQL, Msg, DBName)
If Msg = "查询正确" Then
If Text1(1).Text = JieMi(Rs.Fields(1), Text1(0).Text) Then
If UT = Val(Rs.Fields(2)) Then
UserName = Text1(0).Text
Set Rs = Nothing
If UT = 0 Then
UserType = "admin"
Else
UserType = Empty
End If
Unload Me
Exit Sub
Else
MsgBox "用户类型不正确!", vbInformation, "登录失败 "
End If
Else
MsgBox "密码不正确,请重新输入", vbInformation, "登录失败"
End If
Else
MsgBox "没有此用户,请联系系统管理员", vbInformation, "登录失败"
End If
Set Rs = Nothing
Text1(0).Enabled = True
Text1(1).Enabled = True
Option1(0).Enabled = True
Option1(1).Enabled = True
StatusBar1.Panels(1).Text = "登录失败"
Case 1
Unload FrmMain
End
End Select
End Sub
Private Sub Form_Activate()
Text1(0).SetFocus
End Sub
Private Sub Form_Load()
If App.PrevInstance = True Then
MsgBox "系统已经运行", vbInformation
End
End If
UT = 0
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
TWForm.SetForm Me
TWForm.UnLoadForm
Set TWForm = Nothing
End Sub
Private Sub Option1_Click(Index As Integer)
UT = Index
End Sub
Private Sub Option1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Index
Case 0
StatusBar1.Panels(1).Text = "拥有所有权限"
Case 1
StatusBar1.Panels(1).Text = "限制部分权限"
End Select
End Sub
Private Sub Text1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Index
Case 0
StatusBar1.Panels(1).Text = "管理员用户名"
Case 1
StatusBar1.Panels(1).Text = "用户密码"
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -