📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "登录"
ClientHeight = 1995
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 4170
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1178.712
ScaleMode = 0 'User
ScaleWidth = 3915.404
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer2
Interval = 200
Left = 180
Top = 1080
End
Begin VB.PictureBox Picture1
BorderStyle = 0 'None
Height = 315
Left = 1440
ScaleHeight = 315
ScaleWidth = 2475
TabIndex = 6
Top = 1740
Width = 2475
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "技术支持:freedomhua@163.com"
Height = 180
Left = 1320
TabIndex = 7
Top = 0
Width = 2430
End
End
Begin VB.Timer Timer1
Interval = 500
Left = 60
Top = 960
End
Begin MSComctlLib.ImageList ImageList1
Left = 4200
Top = 60
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 9
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmLogin.frx":030A
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmLogin.frx":0624
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmLogin.frx":093E
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmLogin.frx":0C58
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmLogin.frx":0F72
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmLogin.frx":128C
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmLogin.frx":15A6
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmLogin.frx":18C0
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmLogin.frx":1BDA
Key = ""
EndProperty
EndProperty
End
Begin VB.TextBox txtUserName
Height = 300
Left = 1530
TabIndex = 0
Text = "admin"
Top = 195
Width = 2325
End
Begin VB.CommandButton cmdOK
Caption = "确定"
CausesValidation= 0 'False
Height = 330
Left = 1680
TabIndex = 2
Top = 1320
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 330
Left = 2820
TabIndex = 3
Top = 1320
Width = 1140
End
Begin VB.TextBox txtPassword
Height = 300
IMEMode = 3 'DISABLE
Left = 1530
PasswordChar = "*"
TabIndex = 1
Text = "888888"
Top = 585
Width = 2325
End
Begin VB.Image Image1
Height = 480
Left = 360
Picture = "frmLogin.frx":1EF4
Top = 1140
Width = 480
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "用户名称"
Height = 180
Index = 0
Left = 420
TabIndex = 4
Top = 240
Width = 720
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "密码"
Height = 180
Index = 1
Left = 420
TabIndex = 5
Top = 660
Width = 360
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public LoginSucceeded As Boolean
Private Sub cmdCancel_Click()
'设置全局变量为 false
'不提示失败的登录
LoginSucceeded = False
Me.Hide
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim sqlstr As String
On Error Resume Next
sqlstr = "select * from 用户表 where id='" & Trim(txtUserName.Text) & "' and 密码='" & Trim(txtPassword.Text) & "'"
DoSql sqlstr, True
If mAdoRec.RecordCount = 0 Then
MsgBox "用户或密码错误!请重试!", vbOKOnly + vbInformation, "提示"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
Else
UserID = Trim(txtUserName.Text)
password = Trim(txtPassword.Text)
UserName = mAdoRec.Fields(2)
Unload Me
End If
End Sub
Private Sub Timer1_Timer()
Static i
i = i + 1
Image1.Picture = ImageList1.ListImages(i).Picture
If i = 8 Then
i = 1 - 1
End If
End Sub
Private Sub Timer2_Timer()
Label1.Left = Label1.Left - 50
If Label1.Left < -Label1.Width Then
Label1.Left = Picture1.Width
End If
End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdOK.SetFocus
End If
End Sub
Private Sub txtUserName_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtPassword.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -