制作简单计算器的vb编程一个label 一个文本框 16个按扭分别是清空.123+ 456- 789* 0 计算 /

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 05:59:04
制作简单计算器的vb编程一个label 一个文本框 16个按扭分别是清空.123+ 456- 789* 0 计算 /

制作简单计算器的vb编程一个label 一个文本框 16个按扭分别是清空.123+ 456- 789* 0 计算 /
制作简单计算器的vb编程
一个label 一个文本框 16个按扭分别是清空.123+ 456- 789* 0 计算 /

制作简单计算器的vb编程一个label 一个文本框 16个按扭分别是清空.123+ 456- 789* 0 计算 /
这个计算器包括了你要的功能,并且增加了语音发音功能.一定满足你的需要.成品在 http://www.iz88.net/pro_download/jsq.rar 下载观看.
有问题请在留言薄http://www.iz88.net/book/index.asp中留言说明.
Dim dflag As Integer
Dim I As Integer
Dim opnre As Integer
Dim prev As Double
Dim oflag As Integer
Dim ind As Integer
Dim soundbz As Boolean
Dim ProgramPath As String
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
Public Sub SetOnTop(ByVal IsOnTop As Integer)
Dim rtn As Long
If IsOnTop = 1 Then
'将窗口置于最上面
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
Else
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3)
End If
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
SetOnTop 1
Else
SetOnTop 0
End If
End Sub
Private Sub Command1_Click(Index As Integer)
text1 = Trim(text1)
If Len(text1) > 20 Then
Beep
Exit Sub
End If
soundbz = False
MMControl1.Command = "Close"

MMControl1.FileName = ProgramPath & "/shengyin/" & Index & ".wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"

If ind = 4 Then
prev = 0
text1.Caption = " "
ind = 0
End If
opnre = 0
If oflag = 0 Then
text1.Caption = " "
End If
oflag = 1
If Command1(Index).Caption "." Then
If text1.Caption " 0" Then
text1.Caption = text1.Caption & Command1(Index).Caption
Text = Mid(text1, 1, 1)
If Text = "." Then
text1 = "0" & text1
End If
Else
text1.Caption = " " & Command1(Index).Caption
End If
Else
If dflag = 0 Then
text1.Caption = text1.Caption & "."

dflag = 1
Else
Command6.SetFocus
Exit Sub
End If
End If
Command6.SetFocus
End Sub
Private Sub Command1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then KeyAscii = 0

End Sub
Private Sub Command2_Click(Index As Integer)
soundbz = False
MMControl1.Command = "Close"
If Index = 0 Then MMControl1.FileName = ProgramPath & "/shengyin/加.wav"
If Index = 1 Then MMControl1.FileName = ProgramPath & "/shengyin/减.wav"
If Index = 3 Then MMControl1.FileName = ProgramPath & "/shengyin/乘.wav"
If Index = 2 Then MMControl1.FileName = ProgramPath & "/shengyin/除.wav"
If Index = 4 Then
MMControl1.FileName = ProgramPath & "/shengyin/等于.wav"
soundbz = True
End If
MMControl1.Command = "Open"
MMControl1.Command = "Play"
If opnre = 0 Or Index = 4 Then
If ind = 0 Then
prev = prev + Val(text1.Caption)
ElseIf ind = 1 Then
prev = prev - Val(text1.Caption)
ElseIf ind = 2 Then
If Val(text1.Caption) = 0 Then
text1 = "错误"
Beep
Command6.SetFocus
Exit Sub
Else
prev = prev / Val(text1.Caption)
End If
ElseIf ind = 3 Then
prev = prev * Val(text1.Caption)
End If
text1.Caption = Str(prev)
oflag = 0
End If
opnre = 1
ind = Index
dflag = 0

Command6.SetFocus
If Index = 4 Then
If Option1.Value = True Then text1 = Trim(Round(text1, 2))
If Option2.Value = True Then text1 = Trim(Round(text1, 3))
If Option3.Value = True Then text1 = Trim(Round(text1, 4))
If Option4.Value = True Then text1 = Trim(text1)
If text1 0 Then
Text = Mid(text1, 1, 1)
If Text = "." Then
text1 = "0" & text1
End If
End If
ls = Len(text1)
If ls 0 Then
For I = 1 To ls
t = Mid(text1, I, 1)
DoEvents
Do While (MMControl1.Mode 525) And soundbz

DoEvents
Loop
MMControl1.Command = "Close"
If t "." Then
If t = "-" Then
MMControl1.FileName = ProgramPath & "/shengyin/负.wav"
Else
MMControl1.FileName = ProgramPath & "/shengyin/" & t & ".wav"
End If
Else
MMControl1.FileName = ProgramPath & "/shengyin/10.wav"

End If
MMControl1.Command = "Open"
MMControl1.Command = "Play"
Next I
End If
End If
End Sub
Private Sub Command2_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then KeyAscii = 0
End Sub
Private Sub Command3_Click()
soundbz = False
MMControl1.Command = "Close"
MMControl1.FileName = ProgramPath & "/shengyin/归零.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
text1.Caption = " 0"
Command6.SetFocus
End Sub
Private Sub Command3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then KeyAscii = 0
End Sub
Private Sub Command4_Click()
soundbz = False
MMControl1.Command = "Close"
MMControl1.FileName = ProgramPath & "/shengyin/清除.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"

dflag = 0
prev = 0
oflag = 0
ind = 0
opnre = 0
text1.Caption = " 0"
Command6.SetFocus
End Sub
Private Sub Command4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then KeyAscii = 0
End Sub
Private Sub Command5_Click()
soundbz = False
SaveSetting App.EXEName, "保留", "n1", Option1.Value
SaveSetting App.EXEName, "保留", "n2", Option2.Value
SaveSetting App.EXEName, "保留", "n3", Option3.Value
SaveSetting App.EXEName, "保留", "n4", Option4.Value
SaveSetting App.EXEName, "置顶", "yorn", Check1.Value
' MMControl1.Command = "Close"
Unload Me
End Sub
Private Sub Command5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then KeyAscii = 0
End Sub
Private Sub Command6_Click()
Command2_Click (4)
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If text1 = "错误" Then
Command4_Click
End If

If KeyAscii = Asc(".") Then
I = 10
Command1_Click (I)

ElseIf KeyAscii = Asc("0") Then
I = 0
Command1_Click (I)

ElseIf KeyAscii = Asc("1") Then
I = 1
Command1_Click (I)

ElseIf KeyAscii = Asc("2") Then
I = 2
Command1_Click (I)

ElseIf KeyAscii = Asc("3") Then
I = 3
Command1_Click (I)

ElseIf KeyAscii = Asc("4") Then
I = 4
Command1_Click (I)

ElseIf KeyAscii = Asc("5") Then
I = 5
Command1_Click (I)

ElseIf KeyAscii = Asc("6") Then
I = 6
Command1_Click (I)

ElseIf KeyAscii = Asc("7") Then
I = 7
Command1_Click (I)

ElseIf KeyAscii = Asc("8") Then
I = 8
Command1_Click (I)

ElseIf KeyAscii = Asc("9") Then
I = 9
Command1_Click (I)

ElseIf KeyAscii = Asc("0") Then
I = 0
Command1_Click (I)

ElseIf KeyAscii = Asc("+") Then
I = 0
Command2_Click (I)

ElseIf KeyAscii = Asc("+") Then
I = 0
Command2_Click (I)

ElseIf KeyAscii = Asc("-") Then
I = 1
Command2_Click (I)

ElseIf KeyAscii = Asc("/") Then
I = 2
Command2_Click (I)


ElseIf KeyAscii = Asc("*") Then
I = 3
Command2_Click (I)

ElseIf KeyAscii = Asc("=") Or KeyAscii = 13 Then
I = 4
Command2_Click (I)

ElseIf KeyAscii = Asc("c") Or KeyAscii = Asc("C") Or KeyAscii = 27 Then
Command4_Click
ElseIf KeyAscii = Asc("d") Or KeyAscii = Asc("D") Then
Command3_Click
End If
End Sub
Private Sub Form_Load()
If App.PrevInstance = True Then
Unload Me
MsgBox "程序已运行,不能重复运行", 64, "系统提示"
End
End If
soundbz = True
dflag = 0
prev = 0
oflag = 0
ind = 0
opnre = 0
Clipboard.Clear
MMControl1.DeviceType = "WaveAudio"
ProgramPath = App.Path
Option1.Value = GetSetting(App.EXEName, "保留", "n1", True)
Option2.Value = GetSetting(App.EXEName, "保留", "n2", False)
Option3.Value = GetSetting(App.EXEName, "保留", "n3", False)
Option4.Value = GetSetting(App.EXEName, "保留", "n4", False)
Check1.Value = GetSetting(App.EXEName, "置顶", "yorn", 0)

If App.EXEName "jsq" Then MsgBox "语音计算器即将启动", vbOKOnly, "语音计算器"
End Sub
Private Sub Form_Unload(Cancel As Integer)
MMControl1.Command = "Close"
End
End Sub

制作简单计算器的vb编程一个label 一个文本框 16个按扭分别是清空.123+ 456- 789* 0 计算 / 利用VB编程设计一个类似于Windows附件中的计算器程序,要求可进行简单的算术运算、三角函数和自然对数运算 利用VB编程设计一个类似于Windows附件中的计算器程序,要求可进行简单的算术运算、三角函数和自然对数运算 用C语言编程实现一个简单的四则运算计算器编程:编程实现一个简单的四则运算计算器:从键盘输入一个四则运算表达式(没有空格和括号),遇等号=说明输入结束,输出结果.假设计算器只能 用VB编程设计一个类似于Windows附件中的计算器,如图所示,可进行简单的算术运算、三角函数和自然对数运算求代码,如果每条代码后面有说明就更好了,可以追加100 VB编程:简单多位数相加的计算器把p改成p-1 加好加上双引号后每次结果都是0 看看下面这句话的意思是什么?Begin VB.Label lblMonth Begin VB.Label lblNextBegin VB.Label lblPrev 制作一个能进行四则运算的计算器?要求有0-9数字输入和小数点计算.有3个 文本框,和两个label.加减乘除都解决了,就差数字的编译了! 如何用C#制作简单的计算器,思路是什么啊 用VB编程写一个圆柱体体积的函数过程 用C语言编程,编一个简单的计算器,需要用什么函数?这个计算器的功能有加减乘除,还有乘方,要求小...用C语言编程,编一个简单的计算器,需要用什么函数?这个计算器的功能有加减乘除,还有乘 求有数字按键的简单vb计算器代码,插入到哪才能用呢 卡西欧函数计算器怎样进行简单编程,举个例子,注意,是普通的函数计算器,例如82es 用C++语言编程实现一个简单的四则运算计算器编写一个计算器类,实现加、减、乘、除等基本运算,要求将计算结果存放在成员变量中 如何用VB做一个简单计算器 要求实现加减乘除乘方开方功能 用0~9按钮实现 类似WINDOWS系统自带的计算器 最好带图最好有声明 代码太多 看着晃~ 测量计算器我是学工程测量的,谁能给我推荐一个外业测量上用的可以简单编程常用的计算器,好像可以平差,它的牌子优点和大概的市场价钱. 2、vb编写一个简单的计算器程序,实现两个数的加、减、乘、除.运行结果如下图2所示.2、用VB编写一个简单的计算器程序,实现两个数的加、减、乘、除.运行结果如下图2所示.求源代码我用的 如何制作一个简单的只会加减乘除的计算器,我自学的C语言,代码写好了也能运行,想知道怎么样生成一个像系统自带的那个计算器程序一样的EXE文件.