📄 frm_mm.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Frm_mm
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 4320
ClientLeft = 0
ClientTop = 0
ClientWidth = 7410
LinkTopic = "Form1"
Picture = "Frm_mm.frx":0000
ScaleHeight = 4320
ScaleWidth = 7410
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox Picture1
Height = 4335
Left = 0
Picture = "Frm_mm.frx":5967
ScaleHeight = 4275
ScaleWidth = 7395
TabIndex = 0
Top = 0
Width = 7455
Begin VB.TextBox Txt_Time
Height = 375
Left = 240
TabIndex = 11
Text = "Txt_Time"
Top = 2640
Visible = 0 'False
Width = 975
End
Begin VB.TextBox Txt_mm
Height = 270
IMEMode = 3 'DISABLE
Left = 4920
PasswordChar = "*"
TabIndex = 5
Text = "123"
Top = 3000
Width = 2055
End
Begin MSComctlLib.ImageList Imt_Tx
Left = 1200
Top = 1320
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 64
ImageHeight = 64
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 15
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":191EF
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":1A849
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":1BEA3
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":1D4FD
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":1EB57
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":201B1
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":2180B
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":22E65
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":244BF
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":25B19
Key = ""
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":27173
Key = ""
EndProperty
BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":287CD
Key = ""
EndProperty
BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":29E27
Key = ""
EndProperty
BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":2B481
Key = ""
EndProperty
BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":2CADB
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView1
Height = 3495
Left = 120
TabIndex = 1
Top = 600
Width = 1935
_ExtentX = 3413
_ExtentY = 6165
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "Imt_Tx"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.Label Lbl_Cancel
BackStyle = 0 'Transparent
Height = 255
Index = 1
Left = 5880
TabIndex = 13
Top = 3360
Width = 975
End
Begin VB.Label Lbl_OK
BackStyle = 0 'Transparent
Height = 255
Left = 4680
MouseIcon = "Frm_mm.frx":2E135
MousePointer = 4 'Icon
TabIndex = 12
Top = 3360
Width = 975
End
Begin VB.Label Lbl_Cancel
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "×"
Height = 180
Index = 0
Left = 7080
TabIndex = 10
Top = 120
Width = 180
End
Begin VB.Label Lbl_Infor
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Lbl_Infor"
Height = 180
Left = 2160
TabIndex = 9
Top = 720
Width = 810
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "本软件由陈云松个人独立制作完成"
Height = 180
Index = 3
Left = 2160
TabIndex = 8
Top = 1200
Width = 2700
End
Begin VB.Label Lbl_Czyid
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Lbl_Czyid"
Height = 180
Left = 4920
TabIndex = 7
Top = 2040
Width = 810
End
Begin VB.Label Lbl_Name
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Lbl_Name"
Height = 180
Left = 4920
TabIndex = 6
Top = 2520
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "操作员密码"
Height = 180
Index = 2
Left = 3840
TabIndex = 4
Top = 3000
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "操作员姓名"
Height = 180
Index = 1
Left = 3840
TabIndex = 3
Top = 2520
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "操作员编号"
Height = 180
Index = 0
Left = 3840
TabIndex = 2
Top = 2040
Width = 900
End
Begin VB.Image Img_Tx
Height = 1815
Left = 2280
Stretch = -1 'True
Top = 1920
Width = 1335
End
End
End
Attribute VB_Name = "Frm_mm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Dim itmX As ListItem '声明一个ListItem对象
Dim MyIcon As Integer '声明一个整型变量
Dim MyIndex As String '声明字符串变量
'调用一个窗口的窗口函数,将一条消息发给那个窗口。除非消息处理完毕,否则该函数不会返回。
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
'为当前的应用程序释放鼠标捕获
Private Declare Function ReleaseCapture Lib "user32" () As Long
Const HTCAPTION = 2
Const WM_NCLBUTTONDOWN = &HA1
Private Sub Form_Load()
'向初始化ImageList控件,并向里边添加图片
'Dim imgX As ListImage
' TreeView1.ImageList = ImageList1 '初始化ImageList。
'Set imgX = ImageList1.ListImages.Add(, , LoadPicture("\Image\Head.ico"))
'设置标签内容
Lbl_Infor.Caption = "初始用户名为:mr 密码为:mrsoft "
rs.Open "select * from tb_user", cnn, adOpenKeyset
If rs.RecordCount > 0 Then
rs.MoveFirst
Lbl_Czyid.Caption = rs.Fields("user_id")
Lbl_Name.Caption = rs.Fields("user_name")
MyIcon = Val(Right(rs.Fields("user_tx"), Val(Len(rs.Fields("user_tx")) - 2)))
Set Img_Tx.Picture = Imt_Tx.ListImages(MyIcon).Picture
'向ListView中添加图片
Do While rs.EOF = False
Mystr = rs.Fields("user_name")
MyIcon = Val(Right(rs.Fields("user_tx"), Val(Len(rs.Fields("user_tx")) - 2)))
Set itmX = ListView1.ListItems.Add(, , Mystr, MyIcon)
rs.MoveNext
Loop
End If
rs.Close
Txt_mm.Text = ""
End Sub
Private Sub Lbl_OK_Click()
rs.Open "select * from tb_user where user_name ='" + Trim(Lbl_Name.Caption) + "'", cnn, adOpenKeyset
If rs.RecordCount > 0 Then '如果记录数大于零
'验证操作员及密码
If Txt_mm.Text = rs.Fields("user_mm") Then
Load Frm_Main
Frm_Main.Show
Frm_Main.StatusBar1.Panels(2).Text = Lbl_Name.Caption
Unload Me
Else
If Lbl_Name.Caption = "" Then
MsgBox "请选择操作员!", , "信息提示"
ListView1.SetFocus
Else
If Txt_mm.Text <> rs.Fields("user_mm") Then
MsgBox "密码错误,请重新输入密码!", , "信息提示"
Txt_Time.Text = Val(Txt_Time.Text) + 1
Txt_mm.Text = ""
Txt_mm.SetFocus
End If
End If
If Txt_Time.Text = "3" Then '密码错误3次,退出系统
MyMsg = MsgBox("密码输入错误,请向系统管理员查询!", , "信息提示")
If MyMsg = vbOK Then End
End If
End If
End If
rs.Close
End Sub
Private Sub ListView1_Click()
If ListView1.ListItems.Count > 0 Then
'查询操作员信息
rs.Open "select * from tb_user where user_Name ='" + ListView1.SelectedItem + "'", cnn, adOpenKeyset
If rs.RecordCount > 0 Then
'给相应的控件赋值
Lbl_Czyid.Caption = rs.Fields("user_id")
Lbl_Name.Caption = rs.Fields("user_Name")
MyIcon = Val(Right(rs.Fields("user_tx"), Val(Len(rs.Fields("user_tx")) - 2)))
Set Img_Tx.Picture = Imt_Tx.ListImages(MyIcon).Picture
End If
rs.Close
End If
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
X = ReleaseCapture()
ReturnVal = SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub
Private Sub Txt_mm_GotFocus()
Txt_mm.BackColor = &HFFFF80
End Sub
Private Sub Txt_mm_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Lbl_OK_Click
End Sub
Private Sub Txt_mm_LostFocus()
Txt_mm.BackColor = &HFFFFFF
End Sub
Private Sub Lbl_Cancel_Click(Index As Integer)
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -