frmlogin.frm

来自「用vb实现在线考试系统」· FRM 代码 · 共 179 行

FRM
179
字号
VERSION 5.00
Begin VB.Form frmlogin 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form1"
   ClientHeight    =   2385
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4290
   Icon            =   "frmlogin.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "frmlogin.frx":0442
   ScaleHeight     =   2385
   ScaleWidth      =   4290
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txtUserName 
      Height          =   375
      Left            =   1440
      TabIndex        =   0
      Top             =   600
      Width           =   1455
   End
   Begin VB.TextBox txtPassword 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1440
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   1080
      Width           =   1455
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "登   录"
      DisabledPicture =   "frmlogin.frx":1AA06
      DownPicture     =   "frmlogin.frx":1B5B4
      Height          =   375
      Left            =   3120
      Picture         =   "frmlogin.frx":1CDED
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   600
      Width           =   975
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取   消"
      Height          =   375
      Left            =   3120
      Picture         =   "frmlogin.frx":21089
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   1080
      Width           =   975
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "   数字监控远程管理系统"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   300
      Left            =   720
      TabIndex        =   6
      Top             =   240
      Width           =   2640
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "    用户名"
      Height          =   375
      Left            =   240
      TabIndex        =   5
      Top             =   600
      Width           =   975
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "    密 码"
      Height          =   375
      Left            =   240
      TabIndex        =   3
      Top             =   1080
      Width           =   975
   End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim i As Integer
Dim miCount As Integer

Dim UserName(1 To 10) As String

Private Sub cmdCancel_Click()
        txtUserName.Text = ""
        txtPassword.Text = ""
        Unload Me
End Sub

Private Sub cmdOK_Click()

        UserName(1) = "用户一"
        UserName(2) = "用户二"
        UserName(3) = "用户三"
        UserName(4) = "用户四"
        UserName(5) = "用户五"
        UserName(6) = "用户六"
        UserName(7) = "用户七"
        UserName(8) = "用户八"
        UserName(9) = "用户九"
        UserName(10) = "用户十"
        
        If Trim$(txtUserName.Text) = "" Or Trim$(txtPassword.Text) = "" Then
           MsgBox "用户名密码不能为空", vbOKOnly + vbExclamation, "警告"
            txtUserName.SetFocus
            txtUserName.Text = ""
            txtPassword.Text = ""
         
        Else
            For i = 1 To 10
                If Trim$(txtUserName.Text) = GetIni("User.ini", UserName(i), "登陆名称", "") _
                     And Trim$(txtPassword.Text) = GetIni("User.ini", UserName(i), "登陆密码", "") Then
                    
                    
                    If Dir(frmSetPara.Combo2.Text + ":\save", vbDirectory) = "" Then
                        MkDir frmSetPara.Combo2.Text & ":\Save"
                    End If
                    
                    '检查录像的文件夹是否存在
                    If Dir(frmSetPara.Combo2.Text + ":\picture", vbDirectory) = "" Then
                        MkDir frmSetPara.Combo2.Text & ":\picture"
                    End If
                    
                    
                    
                    Load MainPage
                    
                    If InStr(Trim(GetIni("user.ini", UserName(i), "用户级别", "普通用户")), "系统管理员") Then
                        MainPage.imgSetPara.Enabled = True
                    Else
                        MainPage.imgSetPara.Enabled = False
                    End If
                    MainPage.Show
                    Unload Me
                    Exit Sub
                End If
            Next
            If miCount < 4 Then
                MsgBox "你是非法用户,请重新输入!!!!" & "你还有" & 4 - miCount & "次机会", vbOKOnly + vbExclamation, "警告"
                txtUserName.SetFocus
                txtUserName.Text = ""
                txtPassword.Text = ""
            End If
        End If
        
        miCount = miCount + 1
        If miCount = 5 Then
           MsgBox "对不起,你已经没有机会了!!!!!!!!"
           Unload Me
        End If
        Exit Sub
        
End Sub

⌨️ 快捷键说明

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