login.frm
字号:
VERSION 5.00
Object = "{CFA7AFF4-3242-4269-9172-7389D695AE01}#1.0#0"; "StoneXP.ocx"
Begin VB.Form login
BorderStyle = 0 'None
Caption = "系统登陆"
ClientHeight = 4500
ClientLeft = 0
ClientTop = 0
ClientWidth = 6000
Icon = "login.frx":0000
LinkTopic = "Form3"
ScaleHeight = 4500
ScaleWidth = 6000
StartUpPosition = 1 '所有者中心
Begin StoneXP.XPProgressBar XPProgressBar1
Height = 135
Left = 840
TabIndex = 4
Top = 3960
Width = 4215
_ExtentX = 7435
_ExtentY = 238
End
Begin VB.Timer Timer1
Left = 5400
Top = 3600
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 3480
PasswordChar = "*"
TabIndex = 3
Top = -1000
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 960
TabIndex = 2
Top = -1000
Width = 1455
End
Begin VB.Image Image3
Height = 375
Left = 5580
MouseIcon = "login.frx":F84A
MousePointer = 99 'Custom
ToolTipText = "离开系统"
Top = 30
Width = 375
End
Begin VB.Image Image2
Height = 375
Left = 3270
MouseIcon = "login.frx":F99C
MousePointer = 99 'Custom
ToolTipText = "离开系统"
Top = 3240
Width = 1065
End
Begin VB.Image Image1
Height = 375
Left = 1650
MouseIcon = "login.frx":FAEE
MousePointer = 99 'Custom
ToolTipText = "登陆系统"
Top = 3240
Width = 1000
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 2520
TabIndex = 1
Top = 2580
Width = 1575
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 2520
TabIndex = 0
Top = 2080
Width = 1575
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text2.Text <> "" And Text1.Text <> "" Then
Call Image1_Click
Else
If Text1.Text = "" Then
Text1.SetFocus
Else
Text2.SetFocus
End If
End If
End If
End Sub
Private Sub Form_Load()
login.Picture = LoadPicture(App.Path & "\images\login.jpg")
If qy1.State = adStateOpen Then '在没有任何记录时启用
qy1.Close
End If
qy1.Open "select * from 登录", cnn, adOpenKeyset, adLockReadOnly, adCmdText
If qy1.RecordCount = 0 Then
If qy1.State = adStateOpen Then '在没有任何记录时启用
qy1.Close
End If
qy1.Open "select * from 登录", cnn, adOpenKeyset, adLockOptimistic, adCmdText
qy1.AddNew
qy1.Fields(0) = "admin" '用户名
qy1.Fields(1) = "" '密码
qy1.Fields(2) = "超级管理员" '权限
qy1.Update
End If
End Sub
Private Sub Image1_Click()
If Text1.Text = "" Then
MsgBox "登陆帐号不可为空!", vbInformation, "帐号错误"
Text1.SetFocus
Exit Sub
End If
If qy1.State = adStateOpen Then '借书批准
qy1.Close
End If
qy1.Open "select * from 登录 where 用户名='" & Text1.Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If qy1.EOF = True Then
MsgBox "输入用户名错误!", vbInformation, "错误"
Text1.Text = ""
Text1.SetFocus
Exit Sub
Else
If qy1.Fields(1) = Text2.Text Then
loginname = Text1.Text
useradmin = qy1.Fields(2)
Load form1
Timer1.Interval = 10
XPProgressBar1.Max = 30
Else
MsgBox "密码错误", vbInformation, "错误"
Text2.Text = ""
Text2.SetFocus
Exit Sub
End If
End If
End Sub
Private Sub Image2_Click()
End
End Sub
Private Sub Image3_Click()
End
End Sub
Private Sub Text1_Change()
Label1.Caption = Text1.Text
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Image1_Click
End If
End Sub
Private Sub Text2_Change()
Dim i, a As Integer
a = Len(Text2.Text)
Label2.Caption = ""
For i = 1 To a
Label2.Caption = Label2.Caption + "*"
Next
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Image1_Click
End If
End Sub
Private Sub Timer1_Timer()
'login.Picture = LoadPicture(App.Path & "\images\login-1.jpg")
XPProgressBar1.Value = XPProgressBar1.Value + 1
If XPProgressBar1.Max = XPProgressBar1.Value Then
Unload Me
form1.Show
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -