⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loginform.frm

📁 学生课程设计的作品
💻 FRM
字号:
VERSION 5.00
Begin VB.Form loginform 
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   2370
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   4650
   Icon            =   "loginform.frx":0000
   LinkTopic       =   "Form1"
   Picture         =   "loginform.frx":030A
   ScaleHeight     =   158
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   310
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox loginid 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      ForeColor       =   &H00404040&
      Height          =   270
      Left            =   2040
      TabIndex        =   3
      Top             =   795
      Width           =   1815
   End
   Begin VB.TextBox loginpass 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      ForeColor       =   &H00404040&
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   2040
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1185
      Width           =   1815
   End
   Begin VB.Label Label6 
      BackStyle       =   0  'Transparent
      Caption         =   "Ver: 1.2"
      ForeColor       =   &H00404040&
      Height          =   255
      Left            =   3600
      TabIndex        =   11
      Top             =   360
      Width           =   855
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Height          =   450
      Left            =   1800
      TabIndex        =   10
      Top             =   1680
      Width           =   1245
   End
   Begin VB.Image Image3 
      Height          =   480
      Left            =   1845
      Picture         =   "loginform.frx":24284
      Top             =   1665
      Width           =   480
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "退 出"
      ForeColor       =   &H00404040&
      Height          =   255
      Left            =   2445
      TabIndex        =   9
      Top             =   1830
      Width           =   495
   End
   Begin VB.Shape Shape2 
      BorderColor     =   &H00C0C0C0&
      FillColor       =   &H00C0C0C0&
      Height          =   450
      Left            =   1800
      Top             =   1680
      Width           =   1245
   End
   Begin VB.Label loginok 
      BackStyle       =   0  'Transparent
      Height          =   450
      Left            =   3195
      TabIndex        =   8
      Top             =   1680
      Width           =   1245
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00C0C0C0&
      FillColor       =   &H00C0C0C0&
      Height          =   450
      Left            =   3195
      Top             =   1680
      Width           =   1245
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "登 陆"
      ForeColor       =   &H00404040&
      Height          =   255
      Left            =   3840
      TabIndex        =   7
      Top             =   1830
      Width           =   495
   End
   Begin VB.Image Image2 
      Height          =   480
      Left            =   3240
      Picture         =   "loginform.frx":2A50E
      Top             =   1665
      Width           =   480
   End
   Begin VB.Label loginfrmmove 
      BackColor       =   &H00C0C0C0&
      BackStyle       =   0  'Transparent
      Height          =   285
      Left            =   240
      TabIndex        =   6
      Top             =   0
      Width           =   3840
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "   密码:"
      ForeColor       =   &H00404040&
      Height          =   255
      Left            =   1110
      TabIndex        =   4
      Top             =   1245
      Width           =   915
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "    ID:"
      ForeColor       =   &H00404040&
      Height          =   255
      Left            =   1200
      TabIndex        =   2
      Top             =   840
      Width           =   735
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   360
      Picture         =   "loginform.frx":30798
      Top             =   600
      Width           =   480
   End
   Begin VB.Label formcaption 
      BackStyle       =   0  'Transparent
      Caption         =   "系统登陆"
      Height          =   165
      Left            =   1940
      TabIndex        =   1
      Top             =   85
      Width           =   735
   End
   Begin VB.Label frmcaption2 
      BackStyle       =   0  'Transparent
      Caption         =   "系统登陆"
      ForeColor       =   &H00FFFFFF&
      Height          =   165
      Left            =   1920
      TabIndex        =   0
      Top             =   75
      Width           =   735
   End
End
Attribute VB_Name = "loginform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rsTemp As ADODB.Recordset

Private Function LoginCheck() As Integer
 On Error GoTo err_exit:
   rsTemp.Open "select * from 管理员表 where 管理员='" & Trim(loginid.Text) & "' AND 密码='" & Trim(loginpass.Text) & "'", mydata.condata, adOpenStatic, adLockReadOnly
   If rsTemp.RecordCount >= 1 Then
       LoginCheck = 1
     Else
       LoginCheck = 0
   End If
   rsTemp.Close
   
   Exit Function
err_exit:
   vMessageBox Err.Description, 2, 0
End Function

Private Sub Form_Load()
  '窗口居中
  CenterForm Me
  Now_view = 1
  Set rsTemp = New ADODB.Recordset
  OpenDataBase
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Set rsTemp = Nothing
  
End Sub

Private Sub Label4_Click()
  '按下退出键

  End
End Sub

Private Sub Label4_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  '退出键边框颜色
  Shape2.BorderColor = &H808080
End Sub

Private Sub Label4_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  '退出键边框颜色
  Shape2.BorderColor = &HC0C0C0
End Sub

Private Sub loginfrmmove_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
 '移动无标题窗口
  ReleaseCapture
  SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0
End Sub

Private Sub loginid_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{Tab}"
End Sub

Private Sub loginok_Click()
  Static CheckCount As Integer
  '密码检测并进行登陆
  Dim re As Integer
  re = LoginCheck
  If re = 1 Then
      Now_User = Trim(loginid.Text)
      mainform.Show
      Unload Me
    Else
      CheckCount = CheckCount + 1
      loginid.Text = ""
      loginpass.Text = ""
      loginid.SetFocus
  End If
  
  If CheckCount >= 3 Then
     vMessageBox GetLStr(7), 2, 0
     End
  End If
    

  
End Sub

Private Sub loginok_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  '登陆键边框颜色
  Shape1.BorderColor = &H808080
End Sub

Private Sub loginok_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  '登陆键边框颜色
  Shape1.BorderColor = &HC0C0C0
End Sub

Private Sub loginpass_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then loginok_Click
  
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -