📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form frmLogin
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
Caption = "登录"
ClientHeight = 3480
ClientLeft = 2790
ClientTop = 3045
ClientWidth = 5745
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2056.098
ScaleMode = 0 'User
ScaleWidth = 5394.245
ShowInTaskbar = 0 'False
Begin VB.TextBox txtUserName
Height = 300
IMEMode = 3 'DISABLE
Left = 2280
TabIndex = 2
Top = 1440
Width = 2325
End
Begin CSCommand.Command cmdCancel
Height = 375
Left = 3720
TabIndex = 5
Top = 2760
Width = 1215
_ExtentX = 2143
_ExtentY = 661
IconAlign = 0
Icon = "frmLogin.frx":0442
Caption = "取 消"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdOK
Height = 375
Left = 1920
TabIndex = 4
Top = 2760
Width = 1215
_ExtentX = 2143
_ExtentY = 661
IconAlign = 0
Icon = "frmLogin.frx":045E
Caption = "确 定"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.TextBox txtPassword
Height = 300
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 3
Top = 2160
Width = 2325
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Caption = $"frmLogin.frx":047A
BeginProperty Font
Name = "楷体_GB2312"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00400000&
Height = 3480
Left = 0
TabIndex = 6
Top = 0
Width = 5745
End
Begin VB.Image Image1
Height = 480
Left = 240
Picture = "frmLogin.frx":06A2
Stretch = -1 'True
Top = 1320
Width = 480
End
Begin VB.Image Image2
Height = 480
Left = 240
Picture = "frmLogin.frx":2024
Stretch = -1 'True
Top = 2040
Width = 480
End
Begin VB.Image Image3
Height = 1095
Left = 0
Picture = "frmLogin.frx":39A6
Stretch = -1 'True
Top = 0
Width = 6090
End
Begin VB.Label lblLabels
BackColor = &H00E0E0E0&
Caption = "用户名称:"
Height = 270
Index = 0
Left = 1080
TabIndex = 0
Top = 1440
Width = 960
End
Begin VB.Label lblLabels
BackColor = &H00E0E0E0&
Caption = "登录密码:"
Height = 270
Index = 1
Left = 1080
TabIndex = 1
Top = 2160
Width = 960
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 Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim miCount As Integer
Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
txtSQL = "select * from user_Form where user_ID = '" & txtUserName.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
OK = True
mrc.Close
Me.Hide
UserName = Trim(txtUserName.Text)
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
miCount = miCount + 1
If miCount = 3 Then
Me.Hide
End If
Exit Sub
End Sub
Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call cmdOK_Click
End If
End Sub
Private Sub txtUserName_Click()
txtUserName.Text = ""
End Sub
Private Sub txtUserName_KeyDown(KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -