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

📄 comput.frm

📁 计算器,和windows系统的相似的一个计算器
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      FontName        =   "宋体"
      FontHeight      =   180
      FontCharSet     =   134
      FontPitchAndFamily=   34
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton b1 
      Height          =   375
      Index           =   7
      Left            =   1440
      TabIndex        =   6
      Top             =   1080
      Width           =   525
      ForeColor       =   16711680
      Caption         =   "7"
      Size            =   "917;661"
      FontName        =   "宋体"
      FontHeight      =   180
      FontCharSet     =   134
      FontPitchAndFamily=   34
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton b1 
      Height          =   375
      Index           =   6
      Left            =   2640
      TabIndex        =   5
      Top             =   1560
      Width           =   520
      ForeColor       =   16711680
      Caption         =   "6"
      Size            =   "917;661"
      FontName        =   "宋体"
      FontHeight      =   180
      FontCharSet     =   134
      FontPitchAndFamily=   34
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton b1 
      Height          =   375
      Index           =   3
      Left            =   2640
      TabIndex        =   4
      Top             =   2040
      Width           =   525
      ForeColor       =   16711680
      Caption         =   "3"
      Size            =   "917;661"
      FontName        =   "宋体"
      FontHeight      =   180
      FontCharSet     =   134
      FontPitchAndFamily=   34
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton b1 
      Height          =   375
      Index           =   5
      Left            =   2040
      TabIndex        =   3
      Top             =   1560
      Width           =   520
      ForeColor       =   16711680
      Caption         =   "5"
      Size            =   "917;661"
      FontName        =   "宋体"
      FontHeight      =   180
      FontCharSet     =   134
      FontPitchAndFamily=   34
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton b1 
      Height          =   375
      Index           =   4
      Left            =   1440
      TabIndex        =   2
      Top             =   1560
      Width           =   520
      ForeColor       =   16711680
      Caption         =   "4"
      Size            =   "917;661"
      FontName        =   "宋体"
      FontHeight      =   180
      FontCharSet     =   134
      FontPitchAndFamily=   34
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton b1 
      Height          =   375
      Index           =   2
      Left            =   2040
      TabIndex        =   1
      Top             =   2040
      Width           =   525
      ForeColor       =   16711680
      Caption         =   "2"
      Size            =   "917;661"
      FontName        =   "宋体"
      FontHeight      =   180
      FontCharSet     =   134
      FontPitchAndFamily=   34
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton b1 
      Height          =   375
      Index           =   1
      Left            =   1440
      TabIndex        =   0
      Top             =   2040
      Width           =   525
      ForeColor       =   16711680
      Caption         =   "1"
      Size            =   "917;661"
      FontName        =   "宋体"
      FontHeight      =   180
      FontCharSet     =   134
      FontPitchAndFamily=   34
      ParagraphAlign  =   3
   End
   Begin VB.Menu edit 
      Caption         =   "编辑"
   End
   Begin VB.Menu view 
      Caption         =   "查看"
      Begin VB.Menu hex 
         Caption         =   "十六进制"
      End
      Begin VB.Menu ten 
         Caption         =   "十进制"
      End
      Begin VB.Menu oct 
         Caption         =   "八进制"
      End
      Begin VB.Menu bin 
         Caption         =   "二进制"
      End
   End
   Begin VB.Menu help 
      Caption         =   "帮助"
      Begin VB.Menu helptitle 
         Caption         =   "帮助主题"
      End
      Begin VB.Menu about 
         Caption         =   "关于计算器"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function HideCaret Lib "user32" (ByVal hwnd As Long) As Long
Dim flag As Integer '是否为小数
Dim a As Double
Dim X As Double
Dim Y As Double
Dim ind As Integer
Dim indx As Integer


Private Sub b1_Click(Index As Integer)
a = fun(a, Index, flag)
Text1.Text = convert(a)
countf = 0
indx = 0
End Sub

Private Sub b1_DblClick(Index As Integer, Cancel As MSForms.ReturnBoolean)
  Cancel = True
End Sub


Private Sub clear_Click()
a = 0
X = 0
Y = 0
Text1.Text = "0."
flag = 0
ind = 3
End Sub

Private Sub clear_DblClick(Cancel As MSForms.ReturnBoolean)
   Cancel = True
End Sub

Private Sub CommandButton1_Click()
Dim result As Double
  If a <> 0 Then
    Y = a
  End If
  result = comput(X, Y, ind)
  Text1.Text = convert(result)
  X = result
  a = 0
  flag = 0
  indx = -1
End Sub

Private Sub CommandButton1_DblClick(Cancel As MSForms.ReturnBoolean)
   Cancel = True
End Sub

Private Sub del_Click()
If Len(Trim(Text1.Text)) = 2 Then
   Text1.Text = "0."
Else
   Text1.Text = Left(Text1.Text, Len(Text1.Text) - 2)
End If
a = Val(Text1.Text)
Text1.Text = convert(a)
End Sub

Private Sub del_DblClick(Cancel As MSForms.ReturnBoolean)
  Cancel = True
End Sub

Private Sub dot_Click()
flag = 1
End Sub

Private Sub ds_Click()
X = Val(Text1.Text)
X = 1 / X
Text1.Text = convert(X)
End Sub

Private Sub ds_DblClick(Cancel As MSForms.ReturnBoolean)
   Cancel = True
End Sub

Private Sub fh_Click()
a = -a
Text1.Text = convert(a)
End Sub

Private Sub Form_Load()
flag = 0
a = 0
ind = 3
End Sub

Private Sub Option2_Click()
For i = 0 To 9
   b1(i).Enabled = True
Next i
End Sub

Private Sub Option3_Click()
 For i = 0 To 7
   b1(i).Enabled = True
 Next i
 b1(8).Enabled = False
 b1(9).Enabled = False
End Sub

Private Sub Option4_Click()
For i = 2 To 9
  b1(i).Enabled = False
Next i
End Sub

Private Sub sqrt_Click()
X = Val(Text1.Text)
X = Sqr(X)
Text1.Text = convert(X)
End Sub

Private Sub sqrt_DblClick(Cancel As MSForms.ReturnBoolean)
  Cancel = True
End Sub

Private Sub Text1_Change()
DoEvents
HideCaret Text1.hwnd
End Sub

Private Sub Text1_GotFocus()
DoEvents
HideCaret Text1.hwnd
End Sub

Private Sub ysf_Click(Index As Integer)
Dim result As Double
  If indx <> -1 Then
  Y = a
  result = comput(X, Y, ind)
  Text1.Text = convert(result)
  X = result
 End If
  ind = Index
  a = 0
  flag = 0
End Sub

Private Sub ysf_DblClick(Index As Integer, Cancel As MSForms.ReturnBoolean)
  Cancel = True
End Sub

⌨️ 快捷键说明

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