📄 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 = "生产管理系统"
ClientHeight = 4260
ClientLeft = 0
ClientTop = 0
ClientWidth = 7350
Icon = "Frm_mm.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Picture = "Frm_mm.frx":0CCA
ScaleHeight = 4260
ScaleWidth = 7350
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Txt_Time
Height = 315
Left = 240
TabIndex = 2
Text = "Txt_Time"
Top = 5325
Visible = 0 'False
Width = 1305
End
Begin MSComctlLib.ImageList Imt_Tx
Left = 75
Top = 4755
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 64
ImageHeight = 64
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 10
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":498B
Key = "头像1"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":5FE5
Key = "头像2"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":763F
Key = "头像3"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":8C99
Key = "头像4"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":A2F3
Key = "头像5"
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":B94D
Key = "头像6"
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":CFA7
Key = "头像7"
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":E601
Key = "头像8"
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":FC5B
Key = "头像9"
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":112B5
Key = "头像10"
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView1
Height = 3405
Left = 105
TabIndex = 1
Top = 660
Width = 1920
_ExtentX = 3387
_ExtentY = 6006
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "Imt_Tx"
SmallIcons = "Imt_Tx"
ColHdrIcons = "Imt_Tx"
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 1
NumItems = 0
Picture = "Frm_mm.frx":1290F
End
Begin VB.PictureBox Picture1
BorderStyle = 0 'None
Height = 4350
Left = -15
Picture = "Frm_mm.frx":18286
ScaleHeight = 4350
ScaleWidth = 7440
TabIndex = 3
Top = -30
Width = 7440
Begin VB.TextBox Txt_mm
Height = 345
IMEMode = 3 'DISABLE
Left = 4995
PasswordChar = "*"
TabIndex = 0
Top = 2880
Width = 1950
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Height = 360
Left = 5940
TabIndex = 12
Top = 3315
Width = 945
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Height = 330
Left = 6675
TabIndex = 11
ToolTipText = "关闭退出"
Top = 30
Width = 675
End
Begin VB.Label Lbl_Infor
BackStyle = 0 'Transparent
Caption = "Lbl_Infor"
Height = 615
Left = 2115
TabIndex = 10
Top = 795
Width = 5100
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Height = 300
Left = 4710
TabIndex = 9
Top = 3360
Width = 930
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "操作员密码"
Height = 180
Left = 3900
TabIndex = 8
Top = 2970
Width = 1095
End
Begin VB.Label Lbl_Name
BackStyle = 0 'Transparent
Caption = "Lbl_Name"
ForeColor = &H000000FF&
Height = 210
Left = 4980
TabIndex = 7
Top = 2520
Width = 2055
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "操作员姓名"
Height = 240
Left = 3915
TabIndex = 6
Top = 2550
Width = 1110
End
Begin VB.Label Lbl_Czyid
BackStyle = 0 'Transparent
Caption = "Lbl_Czyid"
ForeColor = &H000000FF&
Height = 240
Left = 4980
TabIndex = 5
Top = 2115
Width = 1605
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "操作员编号"
Height = 255
Left = 3915
TabIndex = 4
Top = 2130
Width = 1005
End
Begin VB.Image Img_Tx
Height = 1785
Left = 2250
Stretch = -1 'True
Top = 1920
Width = 1380
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()
'设置标签内容
Lbl_Infor.Caption = "初始用户名为:mr 密码为:mrsoft " + Chr(10) + Chr(10) + "本软件由明日科技有限公司开发,欢迎各界朋友来电来函垂询!"
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 Label1_Click()
End
End Sub
Private Sub Label2_Click()
End
End Sub
Private Sub Label7_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 Label7_Click
End Sub
Private Sub Txt_mm_LostFocus()
Txt_mm.BackColor = &HFFFFFF
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -