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

📄 竞赛记分器.frm

📁 这是一个竞赛记分器
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Begin VB.CommandButton cmdB 
         Caption         =   "1"
         Height          =   495
         Index           =   0
         Left            =   120
         TabIndex        =   8
         Top             =   480
         Width           =   255
      End
      Begin VB.Label dname 
         Caption         =   "第一队"
         Height          =   375
         Index           =   0
         Left            =   120
         TabIndex        =   7
         Top             =   0
         Width           =   735
      End
   End
   Begin VB.Frame Frame1 
      Height          =   2655
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3135
      Begin VB.CommandButton pause 
         Caption         =   "暂停"
         Height          =   615
         Left            =   2040
         TabIndex        =   43
         Top             =   240
         Visible         =   0   'False
         Width           =   975
      End
      Begin VB.TextBox Text2 
         BackColor       =   &H00000000&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   26.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FFFFFF&
         Height          =   615
         Left            =   240
         Locked          =   -1  'True
         TabIndex        =   37
         Text            =   "0"
         Top             =   720
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Height          =   495
         Left            =   840
         TabIndex        =   1
         Top             =   1920
         Width           =   975
      End
      Begin VB.CommandButton cls0 
         Caption         =   "清零"
         Height          =   495
         Left            =   2040
         TabIndex        =   4
         Top             =   1080
         Width           =   975
      End
      Begin VB.CommandButton start 
         Caption         =   "开始计时"
         Height          =   615
         Left            =   2040
         TabIndex        =   3
         Top             =   240
         Width           =   975
      End
      Begin VB.Label Label10 
         Caption         =   "秒"
         Height          =   375
         Left            =   2160
         TabIndex        =   36
         Top             =   1920
         Width           =   615
      End
      Begin VB.Label Label3 
         Caption         =   "限时"
         Height          =   375
         Left            =   120
         TabIndex        =   5
         Top             =   1920
         Width           =   735
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "计时"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   21.75
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   435
         Left            =   120
         TabIndex        =   2
         Top             =   120
         Width           =   870
      End
   End
   Begin VB.Label Label4 
      Caption         =   "请输入你要的队名"
      Height          =   375
      Left            =   3360
      TabIndex        =   40
      Top             =   3360
      Width           =   1455
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "请选择你要改名的队号(1-6):"
      Height          =   180
      Left            =   3360
      TabIndex        =   39
      Top             =   2880
      Width           =   2430
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim pbool As Boolean
Private Sub cls0_Click()
  Text1.Text = ""
  Text2.Text = "0"
  Timer1.Enabled = False
  Text1.SetFocus
  pbool = False
End Sub

Private Sub cmdG_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = 1 Then
    If cmdG(Index).Caption <> 5 Then
      cmdG(Index).Caption = cmdG(Index).Caption + 5
    Else
      If cmdS(Index).Caption <> 9 Then
        cmdS(Index).Caption = cmdS(Index).Caption + 1
        cmdG(Index).Caption = 0
      Else
        If cmdB(Index).Caption <> 9 Then
          cmdB(Index).Caption = cmdB(Index).Caption + 1
          cmdS(Index).Caption = 0
        Else
          MsgBox "已经不能再加了"
          cmdB(Index).Caption = 1
          Exit Sub
        End If
      End If
    End If
  Else
    If cmdG(Index).Caption <> 0 Then
      cmdG(Index).Caption = cmdG(Index).Caption - 5
    Else
      If cmdS(Index).Caption <> 0 Then
        cmdS(Index).Caption = cmdS(Index).Caption - 1
        cmdG(Index).Caption = 5
      Else
        If cmdB(Index).Caption <> 0 Then
          cmdB(Index).Caption = cmdB(Index).Caption - 1
          cmdS(Index).Caption = 9
        Else
          MsgBox "已经不能再减了"
          cmdB(Index).Caption = 1
          Exit Sub
        End If
      End If
    End If
  End If
End Sub

Private Sub cmdrename_Click()
  Dim dnum As Integer, a As String * 6
  If dh = "" Then
    MsgBox "请选择队号(1-6)", vbCritical, "错误"
    dh.SetFocus
  ElseIf dm = "" Then
    MsgBox "队名不能为空", vbCritical, "错误"
    dm.SetFocus
  Else
    dnum = dh
    a = dm
    dmbool = True
    For i = 0 To 5
      If dh - 1 = i And dname(i).Caption = Trim(a) Then
        dmbool = True
      Else
        If dname(i).Caption = Trim(a) Then
          MsgBox "你输入的队名已经存在,请重新输入"
          dm = ""
          dm.SetFocus
          dmbool = False
        End If
      End If
    Next i
    If dmbool Then
      dname(dnum - 1).Caption = Trim(a)
      a = ""
    End If
  End If
End Sub

Private Sub cmdS_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
   
  If Button = 1 Then
    If cmdS(Index).Caption <> 9 Then
      cmdS(Index).Caption = cmdS(Index).Caption + 1
    Else
      If cmdB(Index).Caption <> 9 Then
        cmdB(Index).Caption = cmdB(Index).Caption + 1
        cmdS(Index).Caption = 0
      Else
        MsgBox "已经不能再加了"
        cmdB(Index).Caption = 1
        cmdS(Index).Caption = 0
        cmdG(Index).Caption = 0
      End If
    End If
  Else
    If cmdS(Index).Caption <> 0 Then
      cmdS(Index).Caption = cmdS(Index).Caption - 1
    Else
      If cmdB(Index).Caption <> 0 Then
        cmdB(Index).Caption = cmdB(Index).Caption - 1
        cmdS(Index).Caption = 9
      Else
        MsgBox "已经不能再减了"
        cmdB(Index).Caption = 1
        cmdS(Index).Caption = 0
        cmdG(Index).Caption = 0
      End If
    End If
  End If
      
End Sub

Private Sub pause_Click()
  Timer1.Enabled = False
  pbool = True
  start.Visible = True
  pause.Visible = False
End Sub

Private Sub start_Click()
  If Not pbool Then
    If IsNumeric(Text1.Text) = False Then
      MsgBox "请输入数值"
    Else
      Text2.Text = Text1.Text
      Timer1.Enabled = True
      start.Visible = False
  pause.Visible = True
    End If
  Else
    Timer1.Enabled = True
  End If
    
End Sub

Private Sub Timer1_Timer()
  Dim sec As Integer

  sec = Val(Text2.Text)

  If sec = 0 Then
     MsgBox "时间到"
     start.Visible = True
     pause.Visible = False
     Timer1.Enabled = False
     
  Else
    sec = sec - 1
    Text2.Text = Str(sec)
  End If
  
End Sub

⌨️ 快捷键说明

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