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

📄 pi.frm

📁 一个VB小程序,能够进行大数的计算,可以作为学习的参考
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Slate 
   BackColor       =   &H00000000&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "PiSlate"
   ClientHeight    =   4575
   ClientLeft      =   45
   ClientTop       =   585
   ClientWidth     =   10215
   BeginProperty Font 
      Name            =   "Fixedsys"
      Size            =   9
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H00E0E0E0&
   Icon            =   "Pi.frx":0000
   MaxButton       =   0   'False
   ScaleHeight     =   59.161
   ScaleLeft       =   -1
   ScaleMode       =   0  'User
   ScaleWidth      =   112.424
   Begin VB.TextBox Box 
      BackColor       =   &H00400000&
      ForeColor       =   &H00E0E0E0&
      Height          =   3735
      Left            =   120
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   2
      TabStop         =   0   'False
      Top             =   720
      Width           =   9975
   End
   Begin VB.TextBox Inpute 
      BackColor       =   &H00700000&
      BorderStyle     =   0  'None
      ForeColor       =   &H00E0E0E0&
      Height          =   240
      Left            =   3240
      TabIndex        =   0
      Text            =   "2792"
      Top             =   240
      Width           =   615
   End
   Begin VB.Label InLabel 
      BackColor       =   &H00000000&
      BackStyle       =   0  'Transparent
      Caption         =   " Pi-decimals [1..9350]"
      ForeColor       =   &H00E0E0E0&
      Height          =   225
      Left            =   240
      TabIndex        =   1
      Top             =   240
      Width           =   2775
   End
   Begin VB.Label Choice 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00000000&
      BackStyle       =   0  'Transparent
      Caption         =   "Spigot"
      ForeColor       =   &H00E0E0E0&
      Height          =   225
      Left            =   9195
      TabIndex        =   3
      Top             =   240
      Width           =   780
   End
   Begin VB.Menu Run 
      Caption         =   "&Run"
      Begin VB.Menu Commands 
         Caption         =   "&Go"
         Index           =   0
         Shortcut        =   {F5}
      End
      Begin VB.Menu Commands 
         Caption         =   "&Break"
         Index           =   1
         Shortcut        =   {F1}
      End
      Begin VB.Menu Commands 
         Caption         =   "&Quit"
         Index           =   2
         Shortcut        =   {F4}
      End
   End
   Begin VB.Menu Method 
      Caption         =   "&Method"
      Begin VB.Menu Methods 
         Caption         =   "&Spigot"
         Checked         =   -1  'True
         Index           =   0
      End
      Begin VB.Menu Methods 
         Caption         =   "Arc&Tan"
         Index           =   1
      End
      Begin VB.Menu Methods 
         Caption         =   "&AGM"
         Index           =   2
      End
   End
End
Attribute VB_Name = "Slate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_Description = "LargeInt pi-computation Visual Basic demo"
'Author : Sjoerd.J.Schaper - vspickelen@zonnet.nl
'URL    : http://largeint.sourceforge.net/index.html
'Date   : 11-11-2004
'Code   : Visual Basic for Windows 5.0
Option Explicit

Private Sub Commands_Click(Index As Integer)
  Select Case Index
  Case 0
    Inpute_KeyPress 13 '              [Enter]
  Case 1
    Key = True '                      mimic the ON KEY event trap
  Case 2
    Close: End '                      [Quit]
  End Select
End Sub

Private Sub Form_Load()
Dim g As String, size As Long, sw As Integer
  sw = Init(size, g)
   WrkD = Trim$(Environ$("LARGEINT"))
   If WrkD = "" Then WrkD = ".\"
   If Right$(WrkD, 1) <> "\" Then WrkD = WrkD + "\"
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Call Term: Cancel = 0
End Sub

Private Sub Inpute_KeyPress(keyascii As Integer)
Dim e As Integer, i As Integer
  If keyascii = 13 Then '             [Enter]
    On Error GoTo errhand
    If Data <> "" Then Exit Sub '     program busy
    e = Val(Inpute.Text)
    If e < 1 Then End '               [Quit]
    For i = 0 To 2
      If Methods(i).Checked = True Then Exit For
    Next i
    '
    Inpute.SetFocus
    Select Case i
    Case 0
      If e > 9350 Then Error 6
      PiSPGOT e
    Case 1
      If e > 11175 Then Error 6
      PiATAN e
    Case 2
      If e > 13 Then Error 6
      PiAGM e
    End Select
  End If
'
eind:
  On Error GoTo 0
  Exit Sub
errhand:
  MsgBox "Value out of range", 48, "Error"
  Inpute.Text = ""
  Resume eind
End Sub

Private Sub Methods_Click(Index As Integer)
Dim i As Integer
  For i = 0 To 2
    If i = Index Then
      Methods(i).Checked = True
    Else
      Methods(i).Checked = False
    End If
  Next i
  Select Case Index
  Case 0
    InLabel.Caption = " Pi-decimals [1..9350]"
    Choice.Caption = "Spigot"
  Case 1
    InLabel.Caption = " Pi-decimals [1..11175]"
    Choice.Caption = "Arctan"
  Case 2
    InLabel.Caption = "AGM-iterations [1..13]"
    Choice.Caption = "AGM"
    Inpute.Text = "11"
  End Select
  Inpute.SetFocus
End Sub


⌨️ 快捷键说明

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