精选文档
PAGE
PAGE 5
—
用VB写计算器似乎有很多例子,这个代码就是其中之一,科学计算器是在基本计算器的基础上,加入角度、弧度、梯度、正切、余切、正弦余弦、平方根等的数学计算,当然基础的加减乘除运算就更不用说了,这是在一本VB教程中摘录的代码,你可以此为基础完善扩展该计算器的功能,运行截图如下:
核心代码,只有一个文件代码:
VERSION 5.00
Begin VB.Form Frm_Scientific
Caption = "计算器"
ClientHeight = 2925
ClientLeft = 165
ClientTop = 735
ClientWidth = 5595
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 2925
ScaleWidth = 5595
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Cmd_Rnd
Caption = "Rnd"
Height = 390
Left = 5025
TabIndex = 39
Top = 1455
Width = 510
End
Begin VB.CommandButton Cmd_PI
Caption = "PI"
Height = 390
Left = 1575
TabIndex = 38
Top = 2400
Width = 630
End
Begin VB.CommandButton Cmd_Fact
Caption = "N!"
Height = 390
Left = 1575
TabIndex = 37
Top = 1935
Width = 630
End
Begin VB.CommandButton Cmd_Log
Caption = "Log"
Height = 390
Left = 1575
TabIndex = 36
Top = 1455
Width = 630
End
Begin VB.CommandButton Cmd_Ln
Caption = "Ln"
Height = 390
Left = 1575
TabIndex = 35
Top = 960
Width = 630
End
Begin VB.CommandButton Cmd_Square
Caption = "X^2"
Height = 390
Left = 840
TabIndex = 34
Top = 2400
Width = 630
End
Begin VB.CommandButton Cmd_Cube
Caption = "X^3"
Height = 390
Left