📄 login.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin
BorderStyle = 0 'None
Caption = "操作员登陆"
ClientHeight = 3030
ClientLeft = 0
ClientTop = -75
ClientWidth = 6675
KeyPreview = -1 'True
LinkTopic = "Form1"
Palette = "login.frx":0000
Picture = "login.frx":57F14
ScaleHeight = 3030
ScaleWidth = 6675
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox t1
Height = 300
Left = 2880
TabIndex = 0
Top = 1320
Width = 2655
End
Begin VB.CheckBox reland
Caption = "重登陆"
Height = 735
Left = 5520
TabIndex = 4
Top = 4200
Width = 1695
End
Begin VB.TextBox Text1
DataField = "user"
DataSource = "Adodc1"
Height = 375
Left = 1200
TabIndex = 3
Text = "Text1"
Top = 3960
Visible = 0 'False
Width = 1815
End
Begin VB.TextBox Text2
DataField = "pw"
DataSource = "Adodc1"
Height = 375
Left = 3120
TabIndex = 2
Text = "Text2"
Top = 3960
Visible = 0 'False
Width = 1815
End
Begin VB.Timer mousemovetimer
Enabled = 0 'False
Interval = 10
Left = 0
Top = 3120
End
Begin VB.TextBox t2
Height = 320
IMEMode = 3 'DISABLE
Left = 2880
PasswordChar = "*"
TabIndex = 1
Top = 1800
Width = 2655
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 1200
Top = 4560
Visible = 0 'False
Width = 3735
_ExtentX = 6588
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 2
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "FILE NAME=C:\Program Files\accp\accp.dsn"
OLEDBString = ""
OLEDBFile = "C:\Program Files\accp\accp.dsn"
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from userManagement"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Image pwd2
Height = 330
Left = 5520
Picture = "login.frx":AFE28
ToolTipText = "密码强度:中"
Top = 1800
Visible = 0 'False
Width = 345
End
Begin VB.Image pwd3
Height = 330
Left = 5520
Picture = "login.frx":B049C
ToolTipText = "密码强度:强"
Top = 1800
Visible = 0 'False
Width = 345
End
Begin VB.Image pwd1
Height = 330
Left = 5520
Picture = "login.frx":B0B10
ToolTipText = "密码强度:弱"
Top = 1800
Visible = 0 'False
Width = 345
End
Begin VB.Image clrusername
Height = 300
Left = 5580
ToolTipText = "清空曾经登陆的用户名"
Top = 1320
Width = 300
End
Begin VB.Image picshowdbhelp
Height = 350
Left = 5680
Picture = "login.frx":B1184
Stretch = -1 'True
ToolTipText = "关于数据库和数据源的配置帮助文档"
Top = 2370
Width = 350
End
Begin VB.Image picuser
Height = 285
Left = 1680
Picture = "login.frx":B11DB
ToolTipText = "编辑查看所有帐户"
Top = 2400
Width = 1065
End
Begin VB.Image mousermovepic
Height = 345
Left = 0
Picture = "login.frx":B2227
Top = 0
Width = 6675
End
Begin VB.Image Image3
Height = 120
Left = 6360
Picture = "login.frx":B76E4
Top = 120
Width = 120
End
Begin VB.Image Image2
Height = 285
Left = 4440
Picture = "login.frx":B772D
Top = 2400
Width = 1065
End
Begin VB.Image Image1
Height = 285
Left = 3240
Picture = "login.frx":B8779
Top = 2400
Width = 1065
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public username As String '定义管理员变量
Dim oldx As Integer '为解决全图形窗口没有标题栏而无法拖动的问题而定义的鼠标新旧两个XY变量
Dim oldy As Integer
Dim newx As Integer
Dim newy As Integer
'>>>>>>>>>>>>>>>>>>>>>>>>以下程序段解决全图形窗口的移动问题<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'移植须知:将该功能移植到一个全图片窗口以解决不能移动的问题时,需注意:1 赋值计时器和伪装标题栏到新的全图片窗体中;2 赋值定义的新旧XY值(4个)和本程序段到新的全图片窗体中;3 修改计时器的过程“mousemovetimer_Timer”中的四个窗体名字。4 修改伪装标题栏的图片
'当指定图片(伪装标题栏)被鼠标点击时启动计时器,并记录下当时的初始鼠标坐标
Private Sub mousermovepic_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mousemovetimer.Enabled = True
oldx = X
oldy = Y
End Sub
'当指定图片(伪装标题栏)上鼠标移动时,赋给新的鼠标XY值,注意系统每隔很短的时间会赋值一次。
Private Sub mousermovepic_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
newx = X
newy = Y
End Sub
'当指定图片(伪装标题栏)被鼠标释放时关闭计时器。
Private Sub mousermovepic_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
mousemovetimer.Enabled = False
End Sub
'计时器将定时得到四个值,分别是固定的初始XY值,和不断变化的新的XY值。利用新旧XY的差,可以以此来移动窗体。适当调小计时器间隔时间将有助于移动窗体的流畅性。
Private Sub mousemovetimer_Timer()
frmLogin.Left = frmLogin.Left - (oldx - newx)
frmLogin.Top = frmLogin.Top - (oldy - newy)
End Sub
'>>>>>>>>>>>>>>>>>>>>>>>>以上程序段解决全图形窗口的移动问题<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'窗口初始化
Private Sub Form_Load()
Me.Height = 3030
Me.Width = 6675
Call readuser
End Sub
'回车后调用确定按钮
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Image1_Click
End If
End Sub
'确定按钮功能
Private Sub Image1_Click()
If reland.Value = 0 Then '正常登陆
If login(Trim(t1.Text), Trim(t2.Text)) = True Then
username = t1.Text
frmmain.Show
'状态栏显示欢迎用户信息
frmmain.statmain.Panels(1).Text = "欢迎" & frmLogin.username & "登陆系统!"
'状态栏的警告信息
Call pwdinfo
'写入用户登陆信息
writeini_land (frmLogin.username)
'主窗体中保留当前用户名和密码
frmmain.currentuser.Text = Trim(Me.t1.Text)
frmmain.currentpwd.Text = Trim(Me.t2.Text)
'检查用户名是否出现在users.ini中,如果没有就加入
Call chkandwriteusername(Trim(t1.Text))
Unload Me
End If
Else '重登陆
If login(Trim(t1.Text), Trim(t2.Text)) = True Then
username = t1.Text
frmmain.Visible = True
'状态栏显示欢迎用户信息
frmmain.statmain.Panels(1).Text = "欢迎" & frmLogin.username & "登陆系统!"
'状态栏的警告信息
Call pwdinfo
'写入用户登陆信息
writeini_land (frmLogin.username)
'主窗体中保留当前用户名和密码
frmmain.currentuser.Text = Trim(Me.t1.Text)
frmmain.currentpwd.Text = Trim(Me.t2.Text)
'检查用户名是否出现在users.ini中,如果没有就加入
Call chkandwriteusername(Trim(t1.Text))
Unload Me
End If
End If
End Sub
'退出按钮功能
Private Sub Image2_Click()
If reland.Value = 0 Then '正常退出
Unload Me
Else '重登陆中退出
Unload Me
frmmain.Visible = True
End If
End Sub
'关闭图片按钮功能实现
Private Sub Image3_Click()
Unload Me
End Sub
'显示数据库设置指南
Private Sub picshowdbhelp_Click()
Shell "showdbhelp.exe"
End Sub
'帐户管理
Private Sub picuser_Click()
frmuserlogin.Show
Me.Visible = False
End Sub
'清空曾经登陆的用户名
Private Sub clrusername_Click()
Shell ("clrusers.exe") '清空users.ini文件
For i = 0 To frmLogin.t1.ListCount '清空当前帐户目录
frmLogin.t1.List(i) = ""
Next
End Sub
Private Sub t2_Change()
Call chkuserpwd(Me.t2.Text)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -