📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BackColor = &H80000003&
BorderStyle = 1 'Fixed Single
Caption = "登录窗口"
ClientHeight = 2775
ClientLeft = 45
ClientTop = 330
ClientWidth = 4455
ControlBox = 0 'False
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2775
ScaleWidth = 4455
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox dbUserId
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 2280
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 5
ToolTipText = "请选择用户"
Top = 360
Width = 1695
End
Begin VB.CommandButton cmdCancel
BackColor = &H80000004&
Cancel = -1 'True
Caption = "取消(&C)"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2280
Style = 1 'Graphical
TabIndex = 4
Top = 1800
Width = 1455
End
Begin VB.CommandButton cmdLogin
BackColor = &H8000000B&
Caption = "登录(&L)"
Default = -1 'True
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
Style = 1 'Graphical
TabIndex = 3
Top = 1800
Width = 1455
End
Begin VB.TextBox txtPasswd
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 2
ToolTipText = "密码和用户名相同"
Top = 1080
Width = 1695
End
Begin VB.Label lblPasswd
BackStyle = 0 'Transparent
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 1
Top = 1080
Width = 1575
End
Begin VB.Label lblUserId
BackStyle = 0 'Transparent
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 0
Top = 360
Width = 1575
End
Begin VB.Shape Shape1
BackColor = &H00E0E0E0&
BackStyle = 1 'Opaque
FillColor = &H00C0E0FF&
Height = 2535
Left = 120
Shape = 4 'Rounded Rectangle
Top = 120
Width = 4215
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Srchflag As Boolean
Private Sub Form_Load()
On Error Resume Next
frmSYSTRAYICON.mnuAboutMe.Enabled = False
frmSYSTRAYICON.mnuExit.Enabled = False
frmSYSTRAYICON.mnuLogoff.Enabled = False
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
txtPasswd = ""
Dim i As Integer
For i = 0 To rsUser.RecordCount
dbUserId.AddItem rsUser(0)
rsUser.MoveNext
If rsUser.EOF = True Then
rsUser.MoveFirst
dbUserId.ListIndex = 0
Exit Sub
End If
Next i
Srchflag = False '初始数据错误
End Sub
'检验密码
Private Sub cmdLogin_Click()
On Error Resume Next
rsUser.Close
rsUser.Open "Select 密码 from 用户 where 用户名 = '" & dbUserId.Text & "'", cn, adOpenDynamic, adLockOptimistic
If rsUser.EOF <> True Then
If rsUser(0) = txtPasswd Then
sUserName = UCase(dbUserId.Text)
frmMain.status.Panels(1).Text = "您好! " & sUserName
DoEvents
'检验用户是否为管理员
'如果是管理员则允许使用设置菜单
If sUserName <> "ADMIN" Then
frmMain.mnuSetting.Enabled = False
Else
frmMain.mnuSetting.Enabled = True
End If
Unload Me
frmSYSTRAYICON.mnuAboutMe.Enabled = True
frmSYSTRAYICON.mnuExit.Enabled = True
frmSYSTRAYICON.mnuLogoff.Enabled = True
DoEvents
frmMain.Show
DoEvents
Exit Sub
rsUser.Close
Else
MsgBox "密码错误!" & vbCrLf & "提示:密码和用户名相同", vbInformation, "出错提示"
txtPasswd.Text = ""
txtPasswd.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub cmdCancel_Click()
On Error Resume Next
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -