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

📄 计算器.frm

📁 饮羽公路测设(glcs) 由20多个公路测量、设计、试验和施工组织设计等小软件组成。如《中桩大地坐标》可以计算不等长缓和曲线的中桩和边桩的大地坐标;《缓和曲线反算》可以根据切线长、外距长或缓和曲线长求
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmjsq 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "表达式计算器"
   ClientHeight    =   3570
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   5760
   Icon            =   "计算器.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   3570
   ScaleWidth      =   5760
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text1 
      Height          =   1335
      Left            =   160
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Text            =   "计算器.frx":0442
      Top             =   600
      Width           =   5415
   End
   Begin VB.TextBox Text2 
      Alignment       =   2  'Center
      BackColor       =   &H00E0E0E0&
      Height          =   270
      Left            =   2520
      Locked          =   -1  'True
      TabIndex        =   4
      Text            =   "Text2"
      Top             =   2760
      Width           =   3015
   End
   Begin VB.CommandButton Command3 
      Caption         =   "取消"
      Height          =   375
      Left            =   4560
      TabIndex        =   3
      Top             =   3120
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   3480
      TabIndex        =   2
      Top             =   3120
      Width           =   975
   End
   Begin VB.Label Label3 
      Caption         =   "数值由表达式计算得到,请在下面编辑框内严格按照算术(或函数)表达式的规则输入计算式:"
      Height          =   375
      Left            =   165
      TabIndex        =   6
      Top             =   120
      Width           =   5415
   End
   Begin VB.Label Label2 
      Caption         =   "计算结果:"
      Height          =   255
      Left            =   1560
      TabIndex        =   5
      Top             =   2760
      Width           =   975
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "表达式中允许使用+ - * / ^ () 及 sin cos tan abs log sqr sec cosec arcsin arccos atn "
      ForeColor       =   &H80000008&
      Height          =   375
      Left            =   165
      TabIndex        =   0
      Top             =   2160
      Width           =   5535
   End
End
Attribute VB_Name = "frmjsq"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Private Const HWND_TOPMOST = -1
    Private Const SWP_SHOWWINDOWS = &H40
    
    Dim cEval As New Evaluator


Private Sub Command1_Click()
'单击确定按钮给相应的文本框赋值

    On Error GoTo handlerror
    
    If Val(Text2.Text) <> 0 Then
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    计算器计算结果:"
        
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + Trim(Text1.Text) + "=" + Trim(Text2.Text)
        
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    --------------------------------------"
    End If
    
    Me.Hide
    
    Exit Sub
handlerror:
    xiansh = MsgBox("在保存数量时出错,请再试试。", vbInformation, "信息提示")

End Sub


Private Sub Command3_Click()
'单击取消按钮
    Unload Me
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer) 'Esc键退出,VbEscape可以用27代替
'按回车键或Esc键时
    
    On Error GoTo handlerror

    If KeyAscii = 13 Then
        Call Command1_Click
    End If

    If KeyAscii = 27 Then   'Esc
        Unload Me
    End If
    
    Exit Sub
handlerror:
    
End Sub

Private Sub Form_Load()
'程序启动

    Dim LValue As Long
    Dim Lxleft As Long, Lxtop As Long
    Dim Lxheight As Long, Lxwidth As Long
    
    On Error GoTo handlerror
    
    '保证窗体在最上面
    Lxleft = Int((frmMain.Text1.Width) / 40)
    Lxtop = Int((frmMain.Text1.Height) / 40)
    
    Lxheight = 260
    Lxwidth = 390
    
    LValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Lxleft, Lxtop, Lxwidth, Lxheight, SWP_NOSIZE)
    
    
    
    Text1.Text = ""
    Text2.Text = ""
    frmjsq.Caption = "表达式计算器"

    Exit Sub
handlerror:

End Sub


Private Sub Text1_Change()
'点击计算以便计算结果

    On Error GoTo handlerror
    
    cEval.Evaluate Text1.Text
    
    Exit Sub
handlerror:

End Sub

⌨️ 快捷键说明

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