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

📄 form2.frm

📁 具有windows计算器所有功能的计算器
💻 FRM
📖 第 1 页 / 共 4 页
字号:
     End If
     
         
End Select
 FLAG2 = True
End Sub

Private Sub Command3_Click(Index As Integer)
If a = 1 Then
Text1.Text = Replace(Text1.Text, "0.", 0)
End If
Select Case Index
  Case 0
    If (Len(Text1.Text) = 2 And Left(Text1.Text, 1) <> "-") Or (Len(Text1.Text) = 3 And Left(Text1.Text, 1) = "-") Then
      Text1.Text = "0" & "."
    ElseIf Right(Trim(Text1.Text), 1) = "." Then
      Text1.Text = Left(Text1.Text, Len(Text1.Text) - 2) & "."
    Else
      Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
    End If
 Case 1
   Text3.Text = Text1.Text
   Text1.Text = "0."
 Case 2
    js = True
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text1.Text = "0."
 End Select
 If a = 1 Then
Text1.Text = Replace(Text1.Text, "0.", 0)
End If
End Sub

Private Sub Command2_Click(Index As Integer)
flag3 = False
Select Case Index
  Case 0 To 3, 4, 5, 6, 8, 9
    Text5.Text = Text4.Text
    
    If js = False Then
      If a = 1 Then
        Text2.Text = jinzhi(Str(Text2.Text))
        Text3.Text = jinzhi(Str(Text3.Text))
        Text4.Text = jinzhi(Str(Text1.Text))
      End If
      Select Case m
       Case 0
        Text1.Text = Val(Text3.Text) / Val(Text4.Text)
       Case 1
        Text1.Text = Val(Text3.Text) * Val(Text4.Text)
       Case 2
        Text1.Text = Val(Text3.Text) - Val(Text4.Text)
       Case 3
        Text1.Text = Val(Text3.Text) + Val(Text4.Text)
       Case 4
        Text1.Text = Val(Text3.Text) Mod Val(Text4.Text)
       Case 5
        Text1.Text = Val(Text3.Text) Or Val(Text4.Text)
      Case 6
        Text1.Text = Val(Text3.Text) ^ Val(Text4.Text)
       Case 8
        Text1.Text = Val(Text3.Text) And Val(Text4.Text)
      Case 9
        Text1.Text = Val(Text3.Text) Xor Val(Text4.Text)
      End Select
       If a = 1 Then
      Text1.Text = Hex(Fix(Text1.Text))
     End If
    Else
      Text3.Text = Text1.Text
    End If
    
    js = False
    Select Case Index
      Case 0
        m = 0
      Case 1
        m = 1
      Case 2
        m = 2
      Case 3
        m = 3
      Case 4
        m = 4
      Case 5
        m = 5
      Case 6
        m = 6
      Case 8
        m = 8
      Case 9
        m = 9
    End Select
   
 Case 7
    js = True
    If Text3.Text = "  " Then
      Exit Sub
    Else
    If a = 1 Then
       Text3.Text = jinzhi(Str(Val(Text3.Text)))
        Text4.Text = jinzhi(Str(Val(Text1.Text)))
    End If
    Select Case m
      
      Case 0
        If Val(Text1.Text) = 0 Then
          x = MsgBox("除数不能为0", , "提示")
        Else
          Text1.Text = Val(Text3.Text) / Val(Text4.Text)
        End If
     Case 1
        Text1.Text = Val(Text4.Text) * Val(Text3.Text)
     Case 2
        Text1.Text = Val(Text3.Text) - Val(Text4.Text)
     Case 3
        Text1.Text = Val(Text3.Text) + Val(Text4.Text)
     Case 4
        Text1.Text = Val(Text3.Text) Mod Val(Text4.Text)
       Case 5
        Text1.Text = Val(Text3.Text) Or Val(Text4.Text)
       Case 6
        Text1.Text = Val(Text3.Text) ^ Val(Text4.Text)
       Case 8
        Text1.Text = Val(Text3.Text) And Val(Text4.Text)
      Case 9
        Text1.Text = Val(Text3.Text) Xor Val(Text4.Text)
    End Select
        If a = 1 Then Text1.Text = Hex(Fix(Text1.Text))
    End If
  
Case 10
  Text1.Text = Not (Text1.Text)
Case 11
  Text1.Text = 3.14159265358979
End Select
If Left(Text1.Text, 1) = "." Then
  Text1.Text = "0" & Text1.Text
ElseIf Left(Text1.Text, 2) = "-." Then
  Text1.Text = Replace(Text1.Text, "-", "-0")
End If
If Val(Text1.Text) = Fix(Val(Text1.Text)) Then
  If Val(Text1.Text) < 0 Then
   Text1.Text = Text1.Text & "."
  Else
   Text1.Text = Text1.Text & "."
  End If
Else
  Text1.Text = Text1.Text
End If
 Text3.Text = Text1.Text
 If Right(Text1.Text, 2) = ".." Then
  Text1.Text = Replace(Text1.Text, "..", ".")
End If

 If a = 1 Then
    If Right(Text1.Text, 1) = "." Then
      Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
    End If
End If

End Sub

Private Sub Command5_Click(Index As Integer)
Dim z As Double
If a = 1 Then
   z = jinzhi(Str(Text1.Text))
  Select Case Index
    Case 5
    Text1.Text = z ^ 2
    Case 6
    Text1.Text = Fix(Log(z))
    Case 7
    Text1.Text = Fix(Log(z) / Log(10))
    Case 9
     Text1.Text = Fix(1 / z)
    End Select
    Text1.Text = Hex(Val(Text1.Text))
Else
Select Case Index
  Case 0
   If b = 2 Then
     Text1.Text = Tan(Val(Text1.Text))
   Else
     Text1.Text = Tan(Val(Text1.Text) / 180 * 3.14159265358979)
    End If
  Case 1
   If b = 2 Then
     Text1.Text = Cos(Val(Text1.Text))
   Else
     Text1.Text = Cos(Val(Text1.Text) / 180 * 3.14159265358979)
    End If
  Case 2
   If b = 2 Then
     Text1.Text = Sin(Val(Text1.Text))
   Else
     Text1.Text = Sin(Val(Text1.Text) / 180 * 3.14159265358979)
    End If
 Case 4
   If b = 2 Then
     Text1.Text = Atn(Val(Text1.Text))
   Else
     Text1.Text = Atn(Val(Text1.Text)) / 3.14159265358979 * 180
    End If
 Case 5
   Text1.Text = Val(Text1.Text) ^ 2
 Case 6
   If Val(Text1.Text) > 0 Then
     Text1.Text = Log(Val(Text1.Text))
   Else
     x = MsgBox("底数不能非正", , "输入提示")
 End If
 Case 7
   If Val(Text1.Text) > 0 Then
     Text1.Text = Log(Val(Text1.Text)) / Log(10)
   Else
     x = MsgBox("底数不能非正", , "输入提示")
 End If
 Case 9
   If Val(Text1.Text) = 0 Then
     x = MsgBox("分母不能为0", , "输入提示")
   Else
    Text1.Text = 1 / Val(Text1.Text)
   End If
End Select
If Left(Text1.Text, 1) = "." Then
  Text1.Text = "0" & Text1.Text
ElseIf Left(Text1.Text, 2) = "-." Then
  Text1.Text = Replace(Text1.Text, "-", "-0")
End If
If Val(Text1.Text) = Fix(Val(Text1.Text)) Then
  If Val(Text1.Text) < 0 Then
   Text1.Text = Text1.Text & "."
  Else
   Text1.Text = Text1.Text & "."
  End If
Else
  Text1.Text = Text1.Text
End If
 Text3.Text = Text1.Text
 If Right(Text1.Text, 2) = ".." Then
  Text1.Text = Replace(Text1.Text, "..", ".")
End If
End If
   

End Sub

Private Sub Command6_Click()
If a = 2 Then
  Text1.Text = jc(Abs(Fix(Text1.Text)))
Else
  Text1.Text = jc(jinzhi(Str(Text1.Text)))
  Text1.Text = Hex(Val(Text1.Text))
End If
End Sub

Private Sub Form_Load()
Option4.Value = True
Option1.Value = True
Option5.Value = True
Command1(12).Enabled = False
Command1(13).Enabled = False
Command1(14).Enabled = False
Command1(15).Enabled = False
Command1(16).Enabled = False
Command1(17).Enabled = False
a = 2
b = 1
js = True
flag = True
FLAG2 = True
flag1 = True
Text2.Text = "0" & "."

End Sub


Private Sub Option1_Click()
b = 1
flag3 = False
End Sub

Private Sub Option2_Click()
b = 2
flag3 = False
End Sub

Private Sub Option3_Click()
a = 1
Picture3.Visible = True
Picture1.Visible = False
Command1(12).Enabled = True
Command1(13).Enabled = True
Command1(14).Enabled = True
Command1(15).Enabled = True
Command1(16).Enabled = True
Command1(17).Enabled = True
Command1(11).Enabled = False
Command5(0).Enabled = False
Command5(1).Enabled = False
Command5(2).Enabled = False
Command5(4).Enabled = False
Command1(10).Enabled = False
Command6.Enabled = False
Command2(11).Enabled = False
Text1.Text = Hex(Fix(Val(Text1.Text)))
Text2.Text = Hex(Fix(Val(Text2.Text)))
Text3.Text = Hex(Fix(Val(Text3.Text)))
Text4.Text = Hex(Fix(Val(Text4.Text)))
flag3 = False
js = True
flag = True
FLAG2 = True
flag1 = True
End Sub

Private Sub Option4_Click()
a = 2
flag3 = False
Picture1.Visible = True
Picture3.Visible = False
Command1(12).Enabled = False
Command1(13).Enabled = False
Command1(14).Enabled = False
Command1(15).Enabled = False
Command1(16).Enabled = False
Command1(17).Enabled = False
Command1(11).Enabled = True
Command5(0).Enabled = True
Command2(11).Enabled = True
Command5(1).Enabled = True
Command5(2).Enabled = True
Command5(4).Enabled = True
Command1(10).Enabled = True
Command6.Enabled = True
Text1.Text = jinzhi(Text1.Text) & "."
End Sub


Private Sub Option5_Click()
flag3 = False
If a = 1 Then
   Text1.MaxLength = 16
   Text1.Text = Right(Text1.Text, 16)
End If
End Sub
Private Sub Option8_Click()
flag3 = False
If a = 1 Then
 Text1.MaxLength = 2
   Text1.Text = Right(Text1.Text, 2)
End If
End Sub
Private Sub Option6_Click()
flag3 = False
If a = 1 Then
Text1.MaxLength = 8
  Text1.Text = Right(Text1.Text, 8)
End If
End Sub

Private Sub Option7_Click()
flag3 = False
If a = 1 Then
Text1.MaxLength = 4
  Text1.Text = Right(Text1.Text, 4)
End If
End Sub

Private Sub Timer1_Timer()
Text6.Text = Time
End Sub

Private Sub 标准型_Click()
Form1.Show
Form2.Hide
Text1.Text = Space(36) & "0."

End Sub
Private Sub 科学型_Click()
Form2.Show
Form1.Hide

End Sub
Private Sub 复制_Click()
Clipboard.Clear
Clipboard.SetText (Text1.Text)
End Sub
Private Sub 粘贴_Click()
Text1.Text = Val(Clipboard.GetText())
If Fix(Text1.Text) = Text1.Text Then Text1.Text = Space(37 - Len(Text1.Text)) & Text1.Text & "."
If Left(Text1.Text, 1) = "." Then
    Text1.Text = Space(37 - Len(Text1.Text)) & "0" & Text1.Text
ElseIf Left(Text1.Text, 2) = "-." Then
   Text1.Text = Space(37 - Len(Text1.Text)) & Replace(Text1.Text, "-", "-0")
End If
End Sub

⌨️ 快捷键说明

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