求将这个VB程序全部翻译一下,会给高分的,所以会麻烦点,VB课程设计答辩,本人电脑小白

PrivateSubForm_Load()Combo1.AddItem"sin(x)"Combo1.AddItem"x*x"Combo1.AddItem"cos(x)"C... Private Sub Form_Load()
Combo1.AddItem "sin(x)"
Combo1.AddItem "x*x"
Combo1.AddItem "cos(x)"
Combo1.AddItem "exp(x)"
Combo1.AddItem "tan(x)"
End Sub

Public Function f(ByVal X!)
If Combo1.Text = "x*x" Then
f = X * X
Picture1.CurrentX = -1
Picture1.CurrentY = 1
Picture1.Print "二次曲线"
Label5.Caption = "-2~2"
ElseIf Combo1.Text = "sin(x)" Then
f = Sin(X)
Picture1.CurrentX = -1
Picture1.CurrentY = 1
Picture1.Print "正弦曲线"
Label5.Caption = "-6.28~6.28"
ElseIf Combo1.Text = "cos(x)" Then f = Cos(X)
Picture1.CurrentX = -1
Picture1.CurrentY = 1
Picture1.Print "余弦曲线"
Label5.Caption = "-6.28~6.28"
ElseIf Combo1.Text = "exp(x)" Then
f = Exp(X)
Picture1.CurrentX = -1
Picture1.CurrentY = 1
Picture1.Print "指数曲线"
Label5.Caption = "-1~1"
ElseIf Combo1.Text = "tan(x)" Then
f = Tan(X)
Picture1.CurrentX = -1
Picture1.CurrentY = 1
Picture1.Print "余切曲线"
Label5.Caption = "-1~1"
End If
End Function
Private Sub Form_Click()
Dim i As Single
Const pi As Single = 3.1415926
Picture1.ScaleMode = 3
Picture1.Scale (-2 * pi, 2)-(2 * pi, -2)
Picture1.DrawWidth = 3
Picture1.Line (0, -2)-(0, 2)
Picture1.Line (-2 * pi, 0)-(2 * pi, 0)
Picture1.DrawWidth = 8
Picture1.PSet (0, 0), RGB(225, 0, 0)
Picture1.ForeColor = RGB(225, 0, 0)
Picture1.CurrentX = 0.1
Picture1.CurrentY = -0.1
Picture1.Print "O"
Picture1.ForeColor = RGB(225, 0, 0)
Picture1.DrawWidth = 2
For i = -2 * pi To 2 * pi Step 0.001
Picture1.PSet (i, f(i))
If Picture1.Point(i, f(i)) = &HFF& Then
Picture1.ForeColor = &HFF00&
Else
Picture1.ForeColor = &HFF&
End If
Next i
End Sub
展开
 我来答
昔俊能Nq
2011-06-24 · TA获得超过937个赞
知道小有建树答主
回答量:518
采纳率:0%
帮助的人:621万
展开全部
Private Sub Form_Load() '窗体的加载时间,启动之后用于初始化
Combo1.AddItem "sin(x)"
Combo1.AddItem "x*x"
Combo1.AddItem "cos(x)" 'Combo1控件的 AddItem方法,增加下拉项中的内容
Combo1.AddItem "exp(x)"
Combo1.AddItem "tan(x)"
End Sub

Public Function f(ByVal X!)
If Combo1.Text = "x*x" Then '根据Combo1中的text,画相应的图形
f = X * X
Picture1.CurrentX = -1 '重新定义Picture1的初始化XY值
Picture1.CurrentY = 1
Picture1.Print "二次曲线" '在当前XY点进行打印 "二次曲线"
Label5.Caption = "-2~2" 'Label5控件中显示 -2~2
ElseIf Combo1.Text = "sin(x)" Then
f = Sin(X) '正弦函数
Picture1.CurrentX = -1
Picture1.CurrentY = 1
Picture1.Print "正弦曲线"
Label5.Caption = "-6.28~6.28"
ElseIf Combo1.Text = "cos(x)" Then f = Cos(X) '余弦曲线
Picture1.CurrentX = -1
Picture1.CurrentY = 1
Picture1.Print "余弦曲线"
Label5.Caption = "-6.28~6.28"
ElseIf Combo1.Text = "exp(x)" Then
f = Exp(X)
Picture1.CurrentX = -1
Picture1.CurrentY = 1
Picture1.Print "指数曲线"
Label5.Caption = "-1~1"
ElseIf Combo1.Text = "tan(x)" Then
f = Tan(X)
Picture1.CurrentX = -1
Picture1.CurrentY = 1
Picture1.Print "余切曲线"
Label5.Caption = "-1~1"
End If
End Function
Private Sub Form_Click()
Dim i As Single
Const pi As Single = 3.1415926 '定义常量PI 圆周率
Picture1.ScaleMode = 3 '修改分辨率模式为像素
Picture1.Scale (-2 * pi, 2)-(2 * pi, -2) '重定义绘制区域坐标
Picture1.DrawWidth = 3 '绘制图形的宽度
Picture1.Line (0, -2)-(0, 2) '画Y方向的坐标
Picture1.Line (-2 * pi, 0)-(2 * pi, 0) '画X方向的坐标
Picture1.DrawWidth = 8 '设置图形的宽度
Picture1.PSet (0, 0), RGB(225, 0, 0) '画原点标记 ,颜色为红色
Picture1.ForeColor = RGB(225, 0, 0) '设置picture1的前景色为红色
Picture1.CurrentX = 0.1 '重定义X和Y的坐标
Picture1.CurrentY = -0.1
Picture1.Print "O" '打印 原点坐标 0
Picture1.ForeColor = RGB(225, 0, 0)
Picture1.DrawWidth = 2 '设置图形宽度为2
For i = -2 * pi To 2 * pi Step 0.001 'X坐标方向 从-2*PI开始 每次增加0.001 进行画点
Picture1.PSet (i, f(i)) 'i 表示X方向的每次等距递增,F(i)算出Y方向的值,pset是画点函数
If Picture1.Point(i, f(i)) = &HFF& Then '获取改点的颜色
Picture1.ForeColor = &HFF00&
Else
Picture1.ForeColor = &HFF&
End If
Next i
End Sub
xuanchi01
2011-06-24 · TA获得超过366个赞
知道答主
回答量:610
采纳率:0%
帮助的人:343万
展开全部
求一个简单的程序设计,外加代码的意义,谢谢 计算器算不算这里是源代码.你应该知道添加哪些控件.(含数组控件) Dim op1 As Byte Dim ops1
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式