📄 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 = 4035
ClientLeft = 0
ClientTop = 0
ClientWidth = 6225
Icon = "Frm_mm.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 4035
ScaleWidth = 6225
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Txt_Time
Height = 345
Left = 90
TabIndex = 1
Text = "Txt_Time"
Top = 4245
Visible = 0 'False
Width = 1080
End
Begin MSComctlLib.ListView ListView1
Height = 1305
Left = 180
TabIndex = 0
Top = 900
Width = 5850
_ExtentX = 10319
_ExtentY = 2302
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 1
NumItems = 0
End
Begin MSComctlLib.ImageList ImageList1
Left = 930
Top = -45
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 10
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":164A
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":2526
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":2E02
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":36DE
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":39FA
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":42D6
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":4BB2
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":548E
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":5D6A
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_mm.frx":6646
Key = ""
EndProperty
EndProperty
End
Begin VB.PictureBox Picture1
BorderStyle = 0 'None
Height = 4065
Left = 0
Picture = "Frm_mm.frx":696A
ScaleHeight = 4065
ScaleWidth = 6255
TabIndex = 2
Top = 0
Width = 6255
Begin VB.TextBox Txt_mm
BorderStyle = 0 'None
ForeColor = &H000080FF&
Height = 285
IMEMode = 3 'DISABLE
Left = 1155
PasswordChar = "*"
TabIndex = 5
Top = 2685
Width = 1605
End
Begin VB.Label Lbl_End
BackStyle = 0 'Transparent
Height = 285
Left = 5745
TabIndex = 9
ToolTipText = "关闭退出"
Top = 30
Width = 450
End
Begin VB.Label Lbl_Exit
BackStyle = 0 'Transparent
Height = 330
Left = 4560
TabIndex = 8
Top = 2640
Width = 1050
End
Begin VB.Label Lbl_OK
BackStyle = 0 'Transparent
Height = 375
Left = 3405
TabIndex = 7
Top = 2625
Width = 1050
End
Begin VB.Label Lbl_Infor
BackStyle = 0 'Transparent
Caption = "Lbl_Infor"
ForeColor = &H000080FF&
Height = 645
Left = 495
TabIndex = 6
Top = 3195
Width = 5295
End
Begin VB.Label Lbl_Name
BackStyle = 0 'Transparent
Caption = "Lbl_Name"
ForeColor = &H000080FF&
Height = 240
Left = 1155
TabIndex = 4
Top = 2325
Width = 1770
End
Begin VB.Label Lbl_Czyid
BackStyle = 0 'Transparent
Caption = "Lbl_Czyid"
ForeColor = &H000080FF&
Height = 150
Left = 3705
TabIndex = 3
Top = 2340
Width = 1620
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 Mystr, MyMsg As String '声明字符串变量
Const HTCAPTION = 2
Const WM_NCLBUTTONDOWN = &HA1
Private Declare Function ReleaseCapture Lib "user32" () As Long
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 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")
'向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_End_Click() '窗体右上角关闭按钮
End
End Sub
Private Sub Lbl_Exit_Click()
End
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.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")
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
Dim ReturnVal As Long
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -