📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "欢迎使用乡镇供电所电费处理系统v2.0"
ClientHeight = 4050
ClientLeft = 2550
ClientTop = 2955
ClientWidth = 4500
ControlBox = 0 'False
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4050
ScaleWidth = 4500
ShowInTaskbar = 0 'False
Tag = "登录"
Begin VB.ListBox List1
Height = 1320
Left = 210
Sorted = -1 'True
TabIndex = 5
Top = 1245
Width = 4050
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
IMEMode = 3 'DISABLE
Left = 225
PasswordChar = "*"
TabIndex = 0
Top = 3015
Width = 4050
End
Begin VB.CommandButton Command2
Caption = "取消(&E)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 3285
TabIndex = 3
Top = 3675
Width = 975
End
Begin VB.CommandButton Command1
Caption = "确定(&O)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1830
MaskColor = &H00404040&
Style = 1 'Graphical
TabIndex = 1
Top = 3675
Width = 975
End
Begin VB.Image Image3
Height = 15
Left = 435
Picture = "frmLogin.frx":0CCA
Top = 720
Width = 4005
End
Begin VB.Image Image2
Height = 480
Left = 210
Picture = "frmLogin.frx":1D56
Top = 255
Width = 480
End
Begin VB.Shape Shape1
BorderColor = &H00808080&
Height = 2655
Index = 1
Left = 15
Top = 900
Width = 4440
End
Begin VB.Shape Shape1
BorderColor = &H00E0E0E0&
Height = 2655
Index = 0
Left = 30
Top = 915
Width = 4440
End
Begin VB.Image Image1
Height = 750
Left = 525
Picture = "frmLogin.frx":2060
Stretch = -1 'True
Top = 1620
Width = 945
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "输入密码(&P):"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 240
TabIndex = 4
Top = 2745
Width = 1365
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请选择用户姓名(&N):"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 255
TabIndex = 2
Top = 1005
Width = 1725
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim OK As Boolean
Private Sub Form_Load()
On Error Resume Next
Dim UserM As Integer
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
UserM = GetSetting(App.EXEName, "RegInfo", "UserN", "")
OpenMdb
Set MdbR = NdMd.OpenRecordset("口令权限")
If MdbR.RecordCount = 0 Then
List1.AddItem "进入口令为admin!"
Else
While Not MdbR.eof
List1.AddItem MdbR.Fields("姓名")
MdbR.MoveNext
Wend
End If
List1.ListIndex = UserM
Command1.Enabled = False
End Sub
Private Sub List1_Click()
On Error Resume Next
SaveSetting App.EXEName, "RegInfo", "UserN", List1.ListIndex 'IIf(List1.ListIndex = -1, 0, List1.ListIndex)
Text1.SetFocus
End Sub
Private Sub Command1_Click()
Dim ShowAtStartup As Long
Static I As Integer
If Text1 = "admin" Then
frmMain.StatusBar1.Panels(5).Text = "操作员:" & "Admin"
Unload Me
ShowAtStartup = GetSetting(App.EXEName, "Options", "Show Tips at Startup", 1)
pbUserPermission = "系统管理员"
If ShowAtStartup = 1 Then
frmTip.Show vbModal
End If
Else
Set MdbR = NdMd.OpenRecordset("select * from 口令权限 where 姓名='" & Trim(List1.Text) & "'")
If MdbR.eof Then
MsgBox "该操作员未找到!", vbCritical
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
Text1.SetFocus
Exit Sub
Else
If Crypt(Trim(Text1.Text), "ND2000MXF") <> Trim(MdbR.Fields("密码")) Then
MsgBox "密码错误,请重新输入!", vbCritical, "提示!"
I = I + 1
If I = 3 Then
Set MdbR = NdMd.OpenRecordset("操作纪录")
With MdbR
.AddNew
.Fields("操作员") = Trim(Left(List1.Text, 5))
.Fields("进入日期") = Now
.Fields("退出日期") = Now
.Fields("操作情况") = "非法进入"
.Update
End With
MsgBox "3次密码输入无效,您的操作记录系统将自动保存," & Chr(13) & "若仍需进入,请联系系统管理员!", vbCritical, "警告!"
Unload Me
End
Else
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SetFocus
End If
Else
pbUserPermission = MdbR.Fields!权限
Set MdbR = NdMd.OpenRecordset("操作纪录")
Operator = Trim(Left(List1.Text, 5))
With MdbR
.AddNew
.Fields("操作员") = Trim(Left(List1.Text, 5))
.Fields("进入日期") = Now
.Fields("操作情况") = "正常进入"
.Update
End With
frmMain.StatusBar1.Panels(5).Text = "操作员:" & Operator
SaveSetting App.EXEName, "SysStart", "Start", "Two"
Unload Me
ShowAtStartup = GetSetting(App.EXEName, "Options", "Show Tips at Startup", 1)
If ShowAtStartup = 1 Then
frmTip.Show vbModal
End If
End If
End If
End If
End Sub
'退出程序 加入退出时封面并显示工作时间和分发操作
Private Sub Command2_Click()
OK = False
Me.Hide
On Error Resume Next
Dim I As Integer
OpenMdb
Set MdbR = NdMd.OpenRecordset("操作纪录")
With MdbR
.Index = "操作员"
.Seek "=", Operator & ""
If Not .NoMatch Then
.Edit
.Fields("退出日期") = Now
.Update
.Close
End If
End With
MdbR.Close
Set MdbR = Nothing
NdMd.Close
Set NdMd = Nothing
For I = Forms.Count - 1 To 1 Step -1
Unload Forms(I)
Next
If frmMain.WindowState <> vbMinimized Then
SaveSetting App.EXEName, "Settings", "MainLeft", frmMain.Left
SaveSetting App.EXEName, "Settings", "MainTop", frmMain.Top
SaveSetting App.EXEName, "Settings", "MainWidth", frmMain.Width
SaveSetting App.EXEName, "Settings", "MainHeight", frmMain.Height
End If
End
End Sub
Private Sub Text1_Change()
If Len(Trim(Text1)) <> 0 Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Len(Text1.Text) <> 0 Then
Command1.Enabled = True
Command1.SetFocus
Command1_Click
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -