📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{3A6644DE-3402-11D9-9DE7-C33FAA87690A}#1.0#0"; "WinXPCEngine.ocx"
Begin VB.Form FrmLogin
AutoRedraw = -1 'True
BorderStyle = 3 'Fixed Dialog
Caption = "系统登录 "
ClientHeight = 3045
ClientLeft = 45
ClientTop = 330
ClientWidth = 5295
ControlBox = 0 'False
Icon = "FrmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3045
ScaleWidth = 5295
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox PicLogin
Height = 495
Index = 0
Left = 360
ScaleHeight = 435
ScaleWidth = 4515
TabIndex = 8
Top = 120
Width = 4575
Begin VB.Label LblWelcome
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "欢迎使用人事工资管理系统"
BeginProperty Font
Name = "楷体_GB2312"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFC0C0&
Height = 360
Index = 1
Left = 0
TabIndex = 10
Top = 0
Width = 4500
End
Begin VB.Label LblWelcome
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "欢迎使用人事工资管理系统"
BeginProperty Font
Name = "楷体_GB2312"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000C000&
Height = 360
Index = 0
Left = 30
TabIndex = 9
Top = 30
Width = 4500
End
End
Begin VB.PictureBox PicLogin
Height = 1095
Index = 1
Left = 720
ScaleHeight = 1035
ScaleWidth = 3915
TabIndex = 3
Top = 1080
Width = 3975
Begin VB.TextBox TxtPassword
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
IMEMode = 3 'DISABLE
Left = 1440
MaxLength = 10
PasswordChar = "*"
TabIndex = 5
ToolTipText = "口令:admin"
Top = 630
Width = 2295
End
Begin VB.TextBox TxtUserName
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 1440
MaxLength = 15
TabIndex = 4
Top = 150
Width = 2295
End
Begin VB.Label LblPassword
AutoSize = -1 'True
Caption = "管理员口令:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Left = 240
TabIndex = 7
Top = 675
Width = 1170
End
Begin VB.Label LblUserName
AutoSize = -1 'True
Caption = "管理员名称:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Left = 240
TabIndex = 6
Top = 195
Width = 1170
End
End
Begin VB.CommandButton CmdCancel
Caption = "取消(&C)"
Height = 375
Left = 3120
TabIndex = 1
Top = 2400
Width = 1335
End
Begin VB.CommandButton CmdLogin
Caption = "登录(&L)"
Default = -1 'True
Height = 375
Left = 960
TabIndex = 0
Top = 2400
Width = 1335
End
Begin VB.Timer TmrMoveText2
Interval = 1
Left = 3000
Top = 0
End
Begin VB.Timer TmrMoveText1
Interval = 1
Left = 2520
Top = 0
End
Begin VB.Timer TmrChangeColor
Interval = 500
Left = 2055
Top = 0
End
Begin WinXPC_Engine.WindowsXPC WinXPLogin
Left = 840
Top = 1320
_ExtentX = 6588
_ExtentY = 1085
ColorScheme = 2
Common_Dialog = 0 'False
End
Begin VB.Label LblShaSi
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C0C0C0&
Height = 210
Index = 1
Left = 360
TabIndex = 2
Top = 750
Width = 105
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 Counts As Byte
Private Sub cmdcancel_Click()
'//结束
End
End Sub
Private Sub CmdLogin_Click()
Dim StrSQL As String
UserName = CStr(Trim(TxtUserName.Text)) '//将文本框内的值赋给定义好的全局变量
PassWord = CStr(Trim(TxtPassWord.Text))
If UserName <> Empty And PassWord <> Empty Then '//用户名与密码是否为空
StrSQL = "select 用户名称,用户口令,用户权限 from 管理用户 where 用户名称= '" & UserName & "'and 用户口令 ='" & PassWord & "'"
If RsLoginCheck.State = adStateClosed Then
RsLoginCheck.Open StrSQL, DBCON, adOpenKeyset, adLockPessimistic, adCmdText '//打开记录集
End If
Group = RsLoginCheck.Fields(2).Value
If RsLoginCheck.Fields(2).Value <> "Administrators" Then
Call CheckLogin
End If
If RsLoginCheck.RecordCount <> 0 Then '//判断记录集记录条数是否为0
RsLoginCheck.Close
Unload Me
Frmmdimain.Show '//显示主窗
ElseIf Counts < 2 Then
MsgBox "用户名域密码错误", vbExclamation + vbOKOnly, "登录失败"
RsLoginCheck.Close '//关闭记录集
Counts = Counts + 1
Else
MsgBox "密码错误不得超过三次,否则视您为非法用户!", vbCritical, "警告"
End
End If
Else
MsgBox "用户名密码不能为空", vbExclamation + vbOKOnly, "登录失败"
Call Form_Load
End If
End Sub
Private Sub Form_Load()
WinXPLogin.InitSubClassing
'//加载主窗时给文本框赋值
TxtUserName.Text = "Administrator"
TxtPassWord.Text = "admin"
End Sub
Private Sub TmrChangeColor_Timer()
'//调用定义好的改变颜色过程,
Call changecolor(LblWelcome(0), 0, 1, 2, 3, 4, 5, 6, 7)
End Sub
Private Sub TmrMoveText1_Timer()
'//移动LblShaSi
'LblShaSi(0).Move LblShaSi(0).Left + 20
LblShaSi(1).Move LblShaSi(1).Left + 20
End Sub
Private Sub TmrMoveText2_Timer()
'//移动LblShaSi
'If LblShaSi(0).Left + LblShaSi(0).Width >= Me.Width + LblShaSi(0).Width Then
' LblShaSi(0).Move -1500
'End If
If LblShaSi(1).Left + LblShaSi(1).Width >= Me.Width + LblShaSi(1).Width Then
LblShaSi(1).Move -1500
End If
End Sub
'//定义一个改变颜色的过程,下面的control就是我们所说的控件
Sub changecolor(LCnt As Control, color1 As Integer, _
color2 As Integer, color3 As Integer, _
color4 As Integer, color5 As Integer, _
color6 As Integer, color7 As Integer, _
color8 As Integer)
Dim tmep As Integer
tmep = Val(LCnt.Tag) '//将返回包含于字符串内的数字赋给TEMP
Select Case tmep
Case color1
LCnt.Tag = color2
Case color2
LCnt.Tag = color3
Case color3
LCnt.Tag = color4
Case color4
LCnt.Tag = color5
Case color5
LCnt.Tag = color6
Case color6
LCnt.Tag = color7
Case color7
LCnt.Tag = color8
Case color8
LCnt.Tag = color1
End Select
LCnt.ForeColor = QBColor(LCnt.Tag) '//给控件LCnt中的字体赋予颜色,注意QBColor是将一值
'//转换为三色,MSDN详解,我也是在那查的````哈
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -