5.5.frm

来自「VB6.0应用例题」· FRM 代码 · 共 141 行

FRM
141
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "求阶乘"
   ClientHeight    =   2250
   ClientLeft      =   4635
   ClientTop       =   2265
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   2250
   ScaleWidth      =   4680
   Begin VB.CommandButton Command2 
      Caption         =   "暂停"
      Height          =   375
      Left            =   2400
      TabIndex        =   6
      Top             =   1560
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "开始"
      Height          =   375
      Left            =   600
      TabIndex        =   5
      Top             =   1560
      Width           =   1455
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   500
      Left            =   4080
      Top             =   360
   End
   Begin VB.HScrollBar HScroll1 
      Height          =   375
      Left            =   480
      Max             =   20
      Min             =   1
      TabIndex        =   2
      Top             =   960
      Value           =   1
      Width           =   3735
   End
   Begin VB.Label Label4 
      Caption         =   "20"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   10.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4320
      TabIndex        =   4
      Top             =   960
      Width           =   615
   End
   Begin VB.Label Label3 
      Caption         =   "1"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   10.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   3
      Top             =   960
      Width           =   255
   End
   Begin VB.Label Label2 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   15
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1080
      TabIndex        =   1
      Top             =   240
      Width           =   3135
   End
   Begin VB.Label Label1 
      Caption         =   "n!="
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   15
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   735
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()  '开始
  Timer1.Enabled = True
End Sub

Private Sub Command2_Click() '暂停
  Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
  n = HScroll1.Value
  nj = 1
  For i = 1 To n    '该循环计算 n!
    nj = nj * i
  Next
  Cls
  Form1.FontSize = 18
  Label1.Caption = Str(n) + "!="
  Label2.Caption = nj
  If HScroll1.Value < 20 Then
     HScroll1.Value = HScroll1.Value + 1
  Else
     HScroll1.Value = 1
  End If
End Sub

⌨️ 快捷键说明

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