📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
BorderStyle = 0 'None
Caption = "Login screen"
ClientHeight = 3345
ClientLeft = 0
ClientTop = 0
ClientWidth = 7380
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmLogin.frx":22A2
ScaleHeight = 3345
ScaleWidth = 7380
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text2
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
IMEMode = 3 'DISABLE
Left = 5520
PasswordChar = "*"
TabIndex = 3
ToolTipText = "Press Enter to login"
Top = 1400
Width = 1335
End
Begin VB.TextBox Text1
BorderStyle = 0 'None
Height = 210
Left = 3480
TabIndex = 2
Top = 1400
Width = 1335
End
Begin VB.Label Label7
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "设置参数"
Height = 315
Left = 690
TabIndex = 8
Top = 2520
Width = 2130
End
Begin VB.Label Label6
BackColor = &H008CBDDE&
Caption = "系统登录"
Height = 255
Left = 1170
TabIndex = 7
Top = 315
Width = 915
End
Begin VB.Label Label5
BackColor = &H0084CEF7&
Caption = " 取消"
Height = 195
Left = 1185
TabIndex = 6
Top = 1830
Width = 615
End
Begin VB.Label Label3
BackColor = &H0084CEF7&
Caption = "登录"
Height = 300
Left = 1260
TabIndex = 5
Top = 1215
Width = 540
End
Begin VB.Image imgTitlebar
Height = 915
Left = 340
Picture = "frmLogin.frx":5F2B
Top = 120
Width = 2370
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "请输入编号和密码"
Height = 855
Left = 2160
TabIndex = 4
Top = 1200
Visible = 0 'False
Width = 1095
End
Begin VB.Image imgLB
Height = 675
Left = 1200
Picture = "frmLogin.frx":69D1
Top = 3600
Width = 1125
End
Begin VB.Image imgCB
Height = 615
Left = 3480
Picture = "frmLogin.frx":6F88
Top = 3720
Width = 1095
End
Begin VB.Image imgCA
Height = 615
Left = 2400
Picture = "frmLogin.frx":755B
Top = 3720
Width = 1095
End
Begin VB.Image imgLA
Height = 675
Left = 120
Picture = "frmLogin.frx":7B2E
Top = 3600
Width = 1125
End
Begin VB.Image imgCancel
Height = 615
Left = 910
Picture = "frmLogin.frx":80E5
Top = 1660
Width = 1095
End
Begin VB.Image imgLogin
Height = 675
Left = 880
Picture = "frmLogin.frx":86B8
Top = 940
Width = 1125
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密码"
Height = 255
Left = 5400
TabIndex = 1
Top = 1080
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "编号"
Height = 255
Left = 3360
TabIndex = 0
Top = 1080
Width = 735
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居
'发布日期:05/06/13
'描 述:一个很酷的登录对话框
'网 站:http://www.mndsoft.com/
'e-mail:mnd@mndsoft.com
'OICQ : 88382850
'****************************************************************************
Option Explicit
Private Sub Form_Load()
Me.Caption = "正在登录系统"
DoTransparency Me, vbRed
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label3.ForeColor = vbBlack
Label5.ForeColor = vbBlack
End Sub
Private Sub imgCancel_Click()
Unload Me
End Sub
Private Sub imgCancel_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label5.ForeColor = vbWhite
End Sub
Private Sub imgLogin_Click()
CheckIfValid
End Sub
Private Sub imgLogin_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label3.ForeColor = vbWhite
End Sub
Private Sub imgTitlebar_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MoveMe
End Sub
Private Sub imgTitlebar_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Form_MouseMove Button, Shift, X, Y
End Sub
Private Sub Label3_Click()
CheckIfValid
End Sub
Private Sub Label5_Click()
Unload Me
End Sub
Private Sub Label7_Click()
ParamterCfg.Show vbModal
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Text2.SetFocus
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
CheckIfValid
Else
Exit Sub
End If
End Sub
Private Sub CheckIfValid()
On Error GoTo ErrHandle
Dim DaCn As New ADODB.Connection
Dim DaRs As New ADODB.Recordset
Dim Sql As String
Dim inName As String
Dim inPass As String
Dim logonSign As Boolean
'//读取用户名称和密码
inName = Trim(Text1.Text)
inName = Trim(Text1.Text)
inPass = obj.getMd5Pass(Trim(Text2.Text), 32)
If inName = "" Then
MsgBox "请输入登录编码", vbCritical + vbOKOnly, obj.getMsgInfo
Text1.SetFocus
Exit Sub
End If
If Trim(Text2.Text) = "" Then
MsgBox "请输入登录密码", vbCritical + vbOKOnly, obj.getMsgInfo
Text2.SetFocus
Exit Sub
End If
Sql = "select Js_UserID from Js_User where Js_UserName='" & inName & "' and Js_UserPass='" & inPass & "'"
DaCn.ConnectionString = obj.getConstr
DaCn.Open
DaRs.CursorLocation = adUseClient
DaRs.Open Sql, DaCn, adOpenStatic, adLockReadOnly
If Not DaRs.EOF And Not IsNull(DaRs("Js_UserID")) Then
UserID = DaRs("Js_UserID")
logonSign = True
Else
logonSign = False
End If
DaRs.Close
DaCn.Close
Set DaRs = Nothing
Set DaRs = Nothing
If logonSign = True Then
Unload Me
FrmMain.Show
Else
MsgBox "名称和密码不正确", vbCritical + vbOKOnly, obj.getMsgInfo
End If
Exit Sub
ErrHandle:
MsgBox "错误:" & Err.Description, vbCritical + vbOKOnly, obj.getMsgInfo
End Sub
Private Sub MoveMe()
ReleaseCapture
SendMessage Me.hwnd, &HA1, 2, 0&
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -