📄 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
BorderStyle = 0 'None
Caption = "系统登录"
ClientHeight = 3525
ClientLeft = 4200
ClientTop = 3000
ClientWidth = 5400
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frm_xtdl.frx":0000
ScaleHeight = 3525
ScaleWidth = 5400
ShowInTaskbar = 0 'False
Begin VB.PictureBox Picture3
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 270
Left = 4950
Picture = "frm_xtdl.frx":3DFAA
ScaleHeight = 270
ScaleWidth = 270
TabIndex = 6
Top = 75
Width = 270
End
Begin VB.PictureBox Picture2
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 315
Left = 4215
Picture = "frm_xtdl.frx":3E3F6
ScaleHeight = 315
ScaleWidth = 720
TabIndex = 5
Top = 3090
Width = 720
End
Begin VB.PictureBox Picture1
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 315
Left = 3105
Picture = "frm_xtdl.frx":3EDD7
ScaleHeight = 315
ScaleWidth = 720
TabIndex = 4
Top = 3090
Width = 720
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 285
IMEMode = 3 'DISABLE
Left = 3570
PasswordChar = "*"
TabIndex = 3
Top = 2700
Width = 1350
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 285
Left = 1215
TabIndex = 2
Top = 2715
Width = 1350
End
Begin MSComctlLib.ImageList ImageList1
Left = 135
Top = 4155
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 34
ImageHeight = 36
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frm_xtdl.frx":3F789
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView1
Height = 1905
Left = 240
TabIndex = 0
Top = 585
Width = 4815
_ExtentX = 8493
_ExtentY = 3360
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 0
NumItems = 0
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 1020
Top = 4080
Width = 2175
_ExtentX = 3836
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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.Label Lbl_Drag
BackStyle = 0 'Transparent
Height = 345
Left = 0
TabIndex = 7
Top = 0
Width = 4845
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
ForeColor = &H00000000&
Height = 225
Left = 195
TabIndex = 1
Top = 3135
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 '定义字符串变量
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()
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3) '运用API函数SetWindowPos,来实现使窗体置前的功能
'使用代码连接数据库与数据表
Call Main
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_SPJXC;Data Source=."
Adodc1.RecordSource = "select * from tb_enter"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False '将操作员信息添加到ListView控件当中
key = Adodc1.Recordset.Fields("M_Name")
Set itmX = ListView1.ListItems.Add(, , key, 1)
Adodc1.Recordset.MoveNext
Loop
End If
adoCon.Close
ScreenCenter
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = LoadPicture(App.Path & "\image\images\login1_07.jpg")
Picture2.Picture = LoadPicture(App.Path & "\image\images\login1_09.jpg")
Picture3.Picture = LoadPicture(App.Path & "\image\images\login_03.jpg")
End Sub
Private Sub Lbl_Drag_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 ListView1_Click()
Text2.Text = ListView1.SelectedItem
Adodc1.RecordSource = "select * from tb_enter where M_Name='" + Text2.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Label3.Caption = "所选操作员的职务: " & Adodc1.Recordset.Fields(2)
Text1.SetFocus
End If
End Sub
Private Sub Picture1_Click()
Dim i As Integer
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '运用API函数SetWindowPos,来实现取消窗体置前的功能
' On Error Resume Next
Adodc1.RecordSource = "select * from tb_enter where M_Name ='" & Text2.Text & "' and m_password ='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
'将权限值赋给数组变量
For i = 1 To 24
bQx(i) = Adodc1.Recordset.Fields(3 + i)
Next i
frm_main.StatusBar1.Panels.Item(2).Text = "当前操作员: " + Adodc1.Recordset.Fields("M_Name")
Name1 = Text2.Text
frm_main.Show
'添加登录日志
Open (App.Path & "\系统日志.ini") For Input As #1
Do While Not EOF(1)
Line Input #1, Intext
TStr = TStr + Intext + Chr(13) + Chr(10)
Loop
Close #1
TStr = TStr + " " + Name1 + " " + Format(Now, "yyyy-mm-dd hh:mm:ss") + " " + "系统登录" + Chr(13) + Chr(10)
Open (App.Path & "\系统日志.ini") For Output As #1
Print #1, TStr
Close #1
Unload Me
Else
MsgBox "错误的用户名或密码!", vbCritical
Text2.Text = ""
Text1.Text = ""
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = LoadPicture(App.Path & "\image\images\login_07.jpg")
End Sub
Private Sub Picture2_Click()
End
End Sub
Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture2.Picture = LoadPicture(App.Path & "\image\images\login_09.jpg")
End Sub
Private Sub Picture3_Click()
End
End Sub
Private Sub Picture3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture3.Picture = LoadPicture(App.Path & "\image\images\login1_03.jpg")
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Picture1_Click
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1.SetFocus
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub ScreenCenter()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -