📄 frm_xtdl.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Begin VB.Form frm_xtdl
Caption = "系统登录"
ClientHeight = 2565
ClientLeft = 4260
ClientTop = 3345
ClientWidth = 4605
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frm_xtdl.frx":0000
ScaleHeight = 2565
ScaleWidth = 4605
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 1320
Top = 3105
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox Txt_Password
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 300
IMEMode = 3 'DISABLE
Left = 3210
PasswordChar = "*"
TabIndex = 5
Top = 1845
Width = 1290
End
Begin VB.TextBox Txt_Name
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 300
Left = 1095
TabIndex = 4
Text = "MR"
Top = 1845
Width = 1290
End
Begin MSComctlLib.ImageList ImageList1
Left = 1275
Top = 1155
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 26
ImageHeight = 26
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frm_xtdl.frx":8CBE
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView1
Height = 1725
Left = 60
TabIndex = 0
Top = 45
Width = 4500
_ExtentX = 7938
_ExtentY = 3043
LabelWrap = -1 'True
HideSelection = -1 'True
OLEDragMode = 1
OLEDropMode = 1
HotTracking = -1 'True
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 0
OLEDragMode = 1
OLEDropMode = 1
NumItems = 0
End
Begin VB.CommandButton Cmd_Ok
Caption = "确定"
Height = 320
Left = 2745
TabIndex = 1
Top = 2190
Width = 875
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 320
Left = 3660
TabIndex = 2
Top = 2190
Width = 875
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
ForeColor = &H00C000C0&
Height = 225
Left = 165
TabIndex = 3
Top = 2295
Width = 2340
End
End
Attribute VB_Name = "frm_xtdl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX As ListItem '定义一个ListItem对象
Dim a
Dim Key As String '定义字符串变量
Private Sub Cmd_Cancel_Click()
End
End Sub
'用户登录按钮的事件代码
Private Sub Cmd_Ok_Click()
On Error Resume Next
Dim MPassword As String
If Txt_Name.Text = "MR" And Txt_Password.Text = "mingrisoft" Then '判断是否使用的是超级口令登录
Name1 = Txt_Name.Text
frm_Main.StatusBar1.Panels.Item(2).Text = "当前操作员: MR"
Unload Me
frm_Main.Show
Else
Adodc1.RecordSource = "select * from tb_user where user_name ='" & Txt_Name.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MPassword = Adodc1.Recordset.Fields("user_mm")
If Txt_Password.Text = MPassword Then '判断数据的密码是否正确
Name1 = Txt_Name.Text
frm_Main.StatusBar1.Panels.Item(2).Text = "当前操作员: " + Adodc1.Recordset.Fields("user_name")
frm_Main.Show
Unload Me
Else
MsgBox "密码不正确,请您确认后重新输入", , "提示信息"
Txt_Password.Text = ""
Txt_Password.SetFocus
End If
Else
MsgBox "对不起 没有此用户的信息", , "提示信息"
Txt_Name.Text = ""
Txt_Password.Text = ""
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Call WHScreen
'使用代码连接数据库与数据表
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_user"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
ListView1.Enabled = True
ListView1.ListItems.Clear
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False '将操作员信息添加到ListView控件当中
Key = Adodc1.Recordset.Fields("user_name")
Set itmX = ListView1.ListItems.Add(, , Key, 1)
Adodc1.Recordset.MoveNext
Loop
Else
ListView1.Enabled = False
End If
ScreenCenter
If TWidth <= 800 Or THeigth <= 600 Then
Exit Sub
Else
ChangeScreen '调整屏幕分辨率
ScreenCenter
End If
End Sub
Private Sub ListView1_Click()
Txt_Name.Text = ListView1.SelectedItem
Adodc1.RecordSource = "select * from tb_user where user_name='" + Txt_Name.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Label3.Caption = "所选操作员的职务: " & Adodc1.Recordset.Fields(3)
Txt_Password.SetFocus
End If
End Sub
Private Sub Txt_Password_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Cmd_Ok_Click
End If
End Sub
Private Sub Txt_Name_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Txt_Password.SetFocus
End If
End Sub
Private Sub ScreenCenter()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Sub ChangeScreen() '改变屏幕分辨率函数
MsgBox "您桌面的分辨率并不是800*600,建议您将桌面的分辨率调整成800*600之后,再运行此程序!", 64, "提示信息"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -