📄 form1.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form 登陆框
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 0 'None
Caption = "登陆框"
ClientHeight = 4140
ClientLeft = 0
ClientTop = 0
ClientWidth = 6405
FillColor = &H00FFFFFF&
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 4140
ScaleWidth = 6405
ShowInTaskbar = 0 'False
Begin VB.TextBox Text1
BorderStyle = 0 'None
Height = 255
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 4
Top = 2760
Width = 1095
End
Begin MSComctlLib.ListView ListView1
Height = 1215
Left = 360
TabIndex = 0
Top = 1080
Width = 5775
_ExtentX = 10186
_ExtentY = 2143
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 0
NumItems = 0
End
Begin MSComctlLib.ImageList ImageList1
Left = 3720
Top = 240
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 80
ImageHeight = 80
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 8
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":0D59
Key = "zx"
Object.Tag = "zx"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":19E9
Key = "as"
Object.Tag = "as"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":263C
Key = "aa"
Object.Tag = "aa"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":74B8
Key = "dd"
Object.Tag = "dd"
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":8211
Key = "fff"
Object.Tag = "fff"
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":8EA1
Key = "zxf"
Object.Tag = "zxf"
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":9AF4
Key = "zhu"
Object.Tag = "zhu"
EndProperty
EndProperty
End
Begin VB.Label Label5
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
ForeColor = &H80000008&
Height = 375
Left = 5880
TabIndex = 6
Top = 120
Width = 375
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Height = 855
Left = 360
TabIndex = 5
Top = 3240
Width = 5655
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Height = 255
Left = 4680
TabIndex = 3
Top = 2760
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Height = 255
Left = 3600
TabIndex = 2
Top = 2760
Width = 855
End
Begin VB.Label Label1
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000005&
BackStyle = 0 'Transparent
ForeColor = &H80000008&
Height = 300
Left = 1560
TabIndex = 1
Top = 2400
Width = 930
End
Begin VB.Image picture1
Height = 4050
Left = 120
Picture = "Form1.frx":A84D
Top = 120
Width = 6240
End
End
Attribute VB_Name = "登陆框"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim n%
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()
Set cnn = New ADODB.Connection
cnn.ConnectionString = "Driver={sql server};server=(local);uid=sa;pwd=;database=XSCJ"
cnn.Open
登陆框.Top = Screen.Height / 4
登陆框.Left = Screen.Width / 4
Label4.Caption = "初始用户名为:fff 密码为:fff " + Chr(10) + Chr(10) + "本软件由zhu开发,欢迎各位朋友来电来函垂询!"
Open (App.Path & "\DataBase.ini") For Output As #1
Print #1, "no"
Close #1
rs.Open "select * from 用户表", cnn, adOpenKeyset
If rs.RecordCount > 0 Then
rs.MoveFirst
Label1.Caption = rs.Fields("用户名")
'向ListView中添加图片
Do While rs.EOF = False
ListView1.View = 0
ListView1.Icons = ImageList1.object
Mystr = rs.Fields("用户名")
MyIcon = Val(Right(rs.Fields("头像"), Val(Len(rs.Fields("头像")))))
Set itmX = ListView1.ListItems.Add(, , Mystr, MyIcon)
rs.MoveNext
Loop
End If
rs.Close
End Sub
Private Sub label3_Click()
If rs1.State <> 0 Then rs1.Close
rs1.Open "select * from 用户表 where 用户名= '" & Trim(Label1) & "' and 密码='" & Trim(Text1) & "'", cnn, 3, 1
If Not rs1.EOF Then
学生信息管理系统.Show
Unload Me
ElseIf n < 3 Then
n = n + 1
MsgBox "用户名或密码有误,请重新输入!", 48
Text1 = ""
Text1.SetFocus
Else
MsgBox "对不起,你无权使用本系统!"
End
End If
End Sub
Private Sub label2_Click()
End
End Sub
Private Sub label5_Click()
End
End Sub
Private Sub ListView1_Click()
If ListView1.ListItems.Count > 0 Then
'查询操作员信息
rs.Open "select * from 用户表 where 用户名 ='" + ListView1.SelectedItem + "'", cnn, adOpenKeyset
If rs.RecordCount > 0 Then
'给相应的控件赋值
Label1.Caption = rs.Fields("用户名")
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 Text1_GotFocus()
Text1.BackColor = &HFFFF80
End Sub
Private Sub text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then label3_Click
End Sub
Private Sub text1_LostFocus()
Text1.BackColor = &HFFFFFF
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -