📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BackColor = &H00FF80FF&
BorderStyle = 1 'Fixed Single
Caption = "用户登录"
ClientHeight = 3075
ClientLeft = 45
ClientTop = 330
ClientWidth = 4890
Icon = "frmLogin.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 205
ScaleMode = 3 'Pixel
ScaleWidth = 326
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdCancel
BackColor = &H00FF80FF&
Caption = "取消[&C]"
Height = 330
Left = 2520
Style = 1 'Graphical
TabIndex = 6
Top = 2520
Width = 975
End
Begin VB.CommandButton cmdLogin
BackColor = &H00FF80FF&
Caption = "登录[&L]"
Height = 330
Left = 1080
Style = 1 'Graphical
TabIndex = 5
Top = 2520
Width = 975
End
Begin VB.TextBox txtPassword
Height = 285
IMEMode = 3 'DISABLE
Left = 1920
MaxLength = 16
PasswordChar = "*"
TabIndex = 4
Top = 1560
Width = 1815
End
Begin VB.TextBox txtUsername
Height = 285
Left = 1920
MaxLength = 16
TabIndex = 2
Text = "kevintan"
Top = 960
Width = 1815
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "注:初始用户名为:kevintan 密码为:989425"
Height = 375
Left = 840
TabIndex = 7
Top = 2040
Width = 3015
End
Begin VB.Image Image1
Height = 720
Left = 240
Picture = "frmLogin.frx":08CA
Top = 600
Width = 720
End
Begin VB.Label lblNote
BackStyle = 0 'Transparent
Caption = "请在下面输入用户名和密码登录数据库!注意:用户名和密码不能为空且必须区分大小写。"
Height = 615
Left = 1080
TabIndex = 0
Top = 240
Width = 3345
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密 碼:"
Height = 195
Left = 1080
TabIndex = 3
Top = 1680
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名:"
Height = 195
Left = 1080
TabIndex = 1
Top = 960
Width = 720
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
'裝載字體設置
frmLogin_CharacterShow
End Sub
'系统登录
Private Sub cmdLogin_Click()
If Not (Len(Trim$(txtUserName)) > 0) Or _
Not (Len(Trim(txtPassword)) > 0) Then
MsgBox "用户名和密码不能为空,请重填!", vbExclamation, "提醒"
txtUserName.SetFocus
Else
frmLogin.Caption = "正在连接到 " & psDatabasePath & "..."
frmLogin.Caption = ConnectionDB(txtUserName.Text, txtPassword.Text)
frmLogin.Caption = "用户登陆"
txtUserName.SetFocus
If pbSuccessLogin = True Then '用户登录成功
Unload frmLogin '御载用户登录窗口
End If
End If
End Sub
'退出登录
Private Sub cmdCancel_Click()
End
End Sub
'關閉窗體時顯示訂料表管理系统窗口
Private Sub Form_Unload(Cancel As Integer)
On Error GoTo ErrorHandler
If pbSuccessLogin = True Then '用户登录成功
frmBomList.Show '显示訂料表管理系统窗口
End If
Exit Sub
ErrorHandler:
MsgBox Err.Description, vbCritical, "错误"
End Sub
'釋放frmLogin窗體所佔的繫統資源
Private Sub Form_Terminate()
On Error Resume Next
Set frmLogin = Nothing
End Sub
'鍵盤按鍵處理
Private Sub txtUsername_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
txtPassword.SetFocus
End If
End Sub
Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
cmdLogin.SetFocus
cmdLogin_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -