form0609.frm

来自「VB实验教程源码」· FRM 代码 · 共 93 行

FRM
93
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "计算兔子数"
   ClientHeight    =   2940
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4260
   LinkTopic       =   "Form1"
   ScaleHeight     =   2940
   ScaleWidth      =   4260
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   495
      Left            =   1440
      TabIndex        =   6
      Top             =   2160
      Width           =   1455
   End
   Begin VB.TextBox Text2 
      Alignment       =   2  'Center
      Height          =   495
      Left            =   1560
      TabIndex        =   3
      Top             =   1200
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      Alignment       =   2  'Center
      Height          =   495
      Left            =   1560
      TabIndex        =   0
      Top             =   240
      Width           =   1335
   End
   Begin VB.Label Label4 
      Caption         =   "对兔子"
      Height          =   375
      Left            =   3000
      TabIndex        =   5
      Top             =   1320
      Width           =   735
   End
   Begin VB.Label Label3 
      Caption         =   "共有"
      Height          =   495
      Left            =   720
      TabIndex        =   4
      Top             =   1320
      Width           =   615
   End
   Begin VB.Label Label2 
      Caption         =   "个月"
      Height          =   375
      Left            =   3120
      TabIndex        =   2
      Top             =   360
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "第"
      Height          =   495
      Left            =   720
      TabIndex        =   1
      Top             =   360
      Width           =   615
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Function Fib(n As Integer)
'子函数计算Fibonacci数列
    If n = 1 Or n = 2 Then
        Fib = 1
    Else
        Fib = Fib(n - 1) + Fib(n - 2)
    End If
End Function

Private Sub Command1_Click()
'单击计算按钮
    Dim Total As Long
    Dim Number As Integer
    Number = Val(Text1.Text)
    Total = Fib(Number)
    Text2.Text = Total
End Sub


⌨️ 快捷键说明

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