?? 實用計算器.frm
字號:
VERSION 5.00
Begin VB.Form frmmain
Caption = "實用計算器"
ClientHeight = 3900
ClientLeft = 60
ClientTop = 450
ClientWidth = 3750
LinkTopic = "Form1"
Picture = "實用計算器.frx":0000
ScaleHeight = 3900
ScaleWidth = 3750
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdhs
Caption = "1/X"
Height = 495
Index = 2
Left = 2520
TabIndex = 26
Top = 2640
Width = 495
End
Begin VB.CommandButton cmdhs
Caption = "%"
Height = 495
Index = 1
Left = 2520
TabIndex = 25
Top = 2040
Width = 495
End
Begin VB.CommandButton cmdhs
Caption = "SQRT"
Height = 495
Index = 0
Left = 2520
TabIndex = 24
Top = 1440
Width = 495
End
Begin VB.CommandButton cmdmem
Caption = "M+"
Height = 495
Index = 3
Left = 2520
TabIndex = 23
Top = 3240
Width = 495
End
Begin VB.CommandButton cmdmem
Caption = "MS"
Height = 495
Index = 2
Left = 1920
TabIndex = 22
Top = 3240
Width = 495
End
Begin VB.CommandButton cmdmem
Caption = "MR"
Height = 495
Index = 1
Left = 1320
TabIndex = 21
Top = 3240
Width = 495
End
Begin VB.CommandButton cmdmem
Caption = "MC"
Height = 495
Index = 0
Left = 720
TabIndex = 20
Top = 3240
Width = 495
End
Begin VB.CommandButton cmdequ
Caption = "="
Height = 1095
Left = 3120
TabIndex = 19
Top = 2640
Width = 495
End
Begin VB.CommandButton cmdback
Caption = "←"
Height = 1095
Left = 3120
TabIndex = 18
Top = 1440
Width = 495
End
Begin VB.CommandButton cmdclear
Caption = "C"
Height = 495
Left = 2520
TabIndex = 17
Top = 840
Width = 1095
End
Begin VB.CommandButton cmdfan
Caption = "+/-"
Height = 495
Left = 120
TabIndex = 16
Top = 2640
Width = 495
End
Begin VB.CommandButton cmddot
Caption = "·"
Height = 495
Left = 1320
TabIndex = 15
Top = 2640
Width = 495
End
Begin VB.CommandButton cmdcount
Caption = "+"
Height = 495
Index = 3
Left = 1920
TabIndex = 14
Top = 2640
Width = 495
End
Begin VB.CommandButton cmdcount
Caption = "-"
Height = 495
Index = 2
Left = 1920
TabIndex = 13
Top = 2040
Width = 495
End
Begin VB.CommandButton cmdcount
Caption = "*"
Height = 495
Index = 1
Left = 1920
TabIndex = 12
Top = 1440
Width = 495
End
Begin VB.CommandButton cmdcount
Caption = "/"
Height = 495
Index = 0
Left = 1920
TabIndex = 11
Top = 840
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "9"
Height = 495
Index = 9
Left = 1320
TabIndex = 10
Top = 2040
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "8"
Height = 495
Index = 8
Left = 720
TabIndex = 9
Top = 2040
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "7"
Height = 495
Index = 7
Left = 120
TabIndex = 8
Top = 2040
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "6"
Height = 495
Index = 6
Left = 1320
TabIndex = 7
Top = 1440
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "5"
Height = 495
Index = 5
Left = 720
TabIndex = 6
Top = 1440
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "4"
Height = 495
Index = 4
Left = 120
TabIndex = 5
Top = 1440
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "3"
Height = 495
Index = 3
Left = 1320
TabIndex = 4
Top = 840
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "2"
Height = 495
Index = 2
Left = 720
TabIndex = 3
Top = 840
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "1"
Height = 495
Index = 1
Left = 120
TabIndex = 2
Top = 840
Width = 495
End
Begin VB.CommandButton cmdnum
Caption = "0"
Height = 495
Index = 0
Left = 720
TabIndex = 1
Top = 2640
Width = 495
End
Begin VB.TextBox txtshow
Alignment = 1 'Right Justify
Height = 495
Left = 120
TabIndex = 0
Text = "0."
Top = 120
Width = 3495
End
Begin VB.Label m
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Height = 465
Left = 120
TabIndex = 27
Top = 3240
Width = 495
End
End
Attribute VB_Name = "frmmain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim intnum As Integer
Dim intnum2 As Integer
Dim intnum3 As Double
Dim bcount As Boolean
Dim intnum1 As Double
Dim fcount As Boolean
Dim ecount As Boolean
Dim tcount As Boolean
Dim lcount As Boolean
Dim lennum As Integer
Dim dcount As Boolean
Dim ccount As Boolean
Dim scount As Boolean
Dim divbool As Boolean
Dim numbool As Boolean
Dim hsnum, mem As Integer
Dim txtlen, a As Integer
Dim txttemp As Double
Dim int4 As Integer
Dim intnum5 As Double
Private Sub cmdback_Click()
int4 = 0
tcount = True
If bcount Then Exit Sub
If ecount Then Exit Sub
If scount Then Exit Sub
If txtshow = "0." Then
txtshow = txtshow
Else
If Len(txtshow) = 2 Then
txtshow = "0."
Else
If Right(txtshow, 1) = "." Then
txtshow = Left(txtshow, Len(txtshow) - 2) & "."
Else
txtshow = Left(txtshow, Len(txtshow) - 1)
End If
End If
End If
End Sub
Private Sub cmdclear_Click()
int4 = 0
ccount = True
txtshow = "0."
bcount = False
dcount = False
ecount = False
fcount = False
intnum1 = 0
intnum3 = 0
intnum2 = 0
End Sub
Private Sub cmdcount_Click(Index As Integer)
int4 = 0
ccount = False
If txtshow = "0." Then Exit Sub
intnum1 = txtshow
bcount = True
intnum = Index
End Sub
Private Sub cmddot_Click()
int4 = 0
If Right(txtshow, 1) <> "." Then
dcount = False
Else
dcount = True
intnum2 = Left(txtshow, Len(txtshow) - 1)
End If
End Sub
Private Sub cmdequ_Click()
If ccount = True Then Exit Sub
If txtshow = "0." And numbool = False Then Exit Sub
ecount = True
int4 = int4 + 1
If int4 = 1 Then
intnum3 = txtshow
Select Case intnum
Case 0
txtshow = intnum1 / intnum3
Case 1
txtshow = intnum1 * intnum3
Case 2
txtshow = intnum1 - intnum3
Case 3
txtshow = intnum1 + intnum3
Case 4
txtshow = txtshow
Exit Sub
Case Else
Exit Sub
End Select
Else
intnum5 = txtshow
Select Case intnum
Case 0
txtshow = intnum5 / intnum3
Case 1
txtshow = intnum5 * intnum3
Case 2
txtshow = intnum5 - intnum3
Case 3
txtshow = intnum5 + intnum3
Case 4
txtshow = txtshow
Exit Sub
Case Else
Exit Sub
End Select
End If
If InStr(txtshow, ".") = 0 Then
txtshow = txtshow & "."
Else
If Left(txtshow, 1) = "." Then
txtshow = "0" & txtshow
Else
If Left(txtshow, 1) = "-" And Left(txtshow, 2) = "-." Then
txtshow = "-0" & Abs(txtshow)
Else
txtshow = txtshow
End If
End If
End If
End Sub
Private Sub cmdfan_Click()
txtshow = -txtshow & "."
intnum = 5
int4 = 0
End Sub
Private Sub cmdHS_Click(Index As Integer)
intnum = 4
int4 = 0
scount = True
If txtshow = "0." Then Exit Sub
Select Case Index
Case 0
If Sgn(txtshow) = -1 Then
txtshow = "函數輸入無效"
Else
txtshow = Sqr(Val(txtshow))
End If
Case 1
If bcount Then
txtshow = Val(txtshow)
Else
txtshow = intnum1 * txtshow / 100
End If
Case 2
If txtshow = "" Then
txtshow = "除數不能為零"
Else
txtshow = 1 / txtshow
End If
End Select
If InStr(txtshow, ".") = 0 Then
txtshow = txtshow & "."
Else
If txtshow < 1 And txtshow > 0 Then
txtshow = "0" & txtshow
Else
If txtshow < 0 Then
txtshow = "-" & "0" & Abs(Val(txtshow))
Else
txtshow = txtshow
End If
End If
End If
If InStr(Right(txtshow, 4), "E") <> 0 Then
txtshow = Right(txtshow, Len(txtshow) - 1)
End If
End Sub
Private Sub cmdmem_Click(Index As Integer)
If txtshow = "0." Then Exit Sub
int4 = 0
Select Case Index
Case 0
mem = "0."
m.Caption = ""
Case 1
If m.Caption = "m" Then
txtshow = mem & "."
End If
Case 2
m.Caption = "m"
mem = txtshow
Case 3
mem = txtshow + mem & "."
End Select
End Sub
Private Sub cmdnum_Click(Index As Integer)
numbool = True
int4 = 0
If Right(txtshow, 1) <> "." Then
txtshow = txtshow & Index
Else
If txtshow = "0." Then
txtshow = Index & "."
Else
txttemp = txtshow
txtshow = txttemp & Index & "."
End If
End If
If dcount Then
txtshow = intnum2 & "." & Index
dcount = False
End If
If bcount Then
txtshow = Index & "."
bcount = False
End If
If fcount Then
txtshow = Index & "."
fcount = False
End If
If ecount Then
txtshow = Index & "."
ecount = False
End If
If scount Then
txtshow = Index & "."
scount = False
End If
End Sub
Private Sub Form_Load()
intnum = 6
int4 = 0
End Sub
Private Sub Picture1_Click()
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -