📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmlogin
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 3225
ClientLeft = 5220
ClientTop = 3870
ClientWidth = 4995
Icon = "frmlogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3225
ScaleWidth = 4995
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2880
TabIndex = 8
Top = 2640
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 1080
TabIndex = 7
Top = 2640
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frmlogin.frx":08CA
Left = 2400
List = "frmlogin.frx":08DA
TabIndex = 6
Top = 720
Width = 1575
End
Begin VB.TextBox txt_pwd
Height = 375
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 2
Top = 1920
Width = 1455
End
Begin VB.TextBox txt_user
Height = 375
Left = 2400
TabIndex = 1
Top = 1320
Width = 1455
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "角 色"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 5
Top = 720
Width = 1215
End
Begin VB.Image imgTitleMaximize
Height = 195
Left = 3480
Picture = "frmlogin.frx":08FA
ToolTipText = "Maximize (Disabled)"
Top = 120
Visible = 0 'False
Width = 195
End
Begin VB.Image imgTitleRestore
Height = 195
Left = 3720
Picture = "frmlogin.frx":0B44
ToolTipText = "Maximize (Disabled)"
Top = 120
Visible = 0 'False
Width = 195
End
Begin VB.Image imgTitleclose
Height = 195
Left = 4560
Picture = "frmlogin.frx":0D8E
ToolTipText = "Close"
Top = 120
Width = 195
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 4
Top = 1920
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 3
Top = 1320
Width = 855
End
Begin VB.Image imgWindowLeft
Height = 450
Left = 1080
Picture = "frmlogin.frx":0FD8
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgWindowRight
Height = 450
Left = 720
Picture = "frmlogin.frx":1722
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgTitleHelp
Height = 210
Left = 4080
Picture = "frmlogin.frx":1E6C
Stretch = -1 'True
Top = 120
Width = 210
End
Begin VB.Image imgTitleMinimize
Height = 210
Left = 4320
Picture = "frmlogin.frx":20B6
Stretch = -1 'True
Top = 120
Width = 165
End
Begin VB.Image Imageicon
Height = 315
Left = 1440
Picture = "frmlogin.frx":2300
Stretch = -1 'True
Top = 120
Width = 315
End
Begin VB.Image imgTitleLeft
Height = 450
Left = 0
Picture = "frmlogin.frx":3FCA
Top = 0
Width = 285
End
Begin VB.Image imgTitleRight
Height = 450
Left = 360
Picture = "frmlogin.frx":4714
Top = 0
Width = 285
End
Begin VB.Image imgWindowBottom
Height = 450
Left = 360
Picture = "frmlogin.frx":4E5E
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgTitleMain
Height = 450
Left = 0
Picture = "frmlogin.frx":55A8
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgWindowBottomLeft
Height = 450
Left = 720
Picture = "frmlogin.frx":5CF2
Top = 0
Width = 285
End
Begin VB.Image imgWindowBottomRight
Height = 450
Left = 1080
Picture = "frmlogin.frx":643C
Top = 0
Width = 285
End
Begin VB.Label lblTitle
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户登录"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 240
Left = 2040
TabIndex = 0
Top = 240
Width = 1140
End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim miCount As Integer
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_user.SetFocus
End If
End Sub
Private Sub Form_Load()
MakeWindow Me
End Sub
Private Sub Command1_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
If Trim(Combo1.Text) = "" Then
MsgBox "请选择你的角色", vbInformation + vbOKCancel, "提示"
Exit Sub
End If
Password = Trim(txt_pwd.Text)
user_name = Trim(txt_user.Text)
If Trim(txt_user.Text = "") Then
MsgBox "请输入用户名", vbOKOnly + vbExclamation, "提示"
txt_user.SetFocus
Else
txtSQL = "select * from user_If where Uname = '" & txt_user.Text & "'"
Set mrc = MyDB.ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "警告"
txt_user.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txt_pwd.Text) Then
role1 = Trim(mrc.Fields(2)) '获取用户权限
If Combo1.ListIndex <> role1 Then
MsgBox "你选择角色错误,请重新选择", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
mrc.Close
Unload Me
frmmain.Show
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txt_pwd.SetFocus
txt_pwd.Text = ""
End If
End If
End If
miCount = miCount + 1
If miCount = 3 Then
MsgBox "对不起!您登录的次数超过3次,将自动取消!", vbOKOnly + vbInformation, "警告"
Me.Hide
Exit Sub
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub imgTitleclose_Click()
Unload Me
End Sub
Private Sub imgTitleLeft_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DoDrag Me
End Sub
Private Sub imgTitleMain_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DoDrag Me
End Sub
Private Sub imgTitleMinimize_Click()
Me.WindowState = 1
End Sub
Private Sub imgTitleRestore_Click()
Me.WindowState = 2
End Sub
Private Sub imgTitleRight_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DoDrag Me
End Sub
Private Sub lblTitle_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DoDrag Me
End Sub
Private Sub txt_pwd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.Value = True
End If
End Sub
Private Sub txt_user_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt_pwd.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -