求助 用VB画一个用频率和副值控制的正弦曲线

来源:百度知道 编辑:UC知道 时间:2024/06/30 09:24:11
求助 用VB画一个用频率和副值控制的正弦曲线 急哦 就是Y=asinbX

每填入一组 a b 按下确定就出来个正弦曲线

哪位大哥能不能给我写下代码 谢谢了哦
谢谢一楼的大哥先哈 我是想 在界面上有填入a b 的空格的您看怎么给改下 还有能不能写的详细些哦 我好象运行不了你的程序哦 我是菜鸟哈 刚开始学VB

也先谢谢2楼的大哥哈 你的程序能运行的 不过您看能不在界面上有填入a b 的空格的 就是再加两个Textbox哦 麻烦了哦

那就这样

Private Sub Command1_Click()
Dim a As Double, b As Double
Dim w As Long, h As Long
Dim x As Double, y As Double
a = Text1
b = Text2
w = Picture1.ScaleWidth
h = Picture1.ScaleHeight
Picture1.Cls
Picture1.Line (-w / 2, 0)-(w / 2, 0), vbBlack
Picture1.Line (0, h / 2)-(0, -h / 2), vbBlack
Picture1.PSet (-w / 2, a * Sin(-w / 2 * b)), vbBlack
For x = -w / 2 To w / 2
y = a * Sin(b * x)
Picture1.Line -(x, y), vbBlack
Next
End Sub

Private Sub Form_Load()
Picture1.ScaleMode = 3
Picture1.AutoRedraw = True
Picture1.Appearance = 0
Picture1.BorderStyle = 0
Picture1.Scale (-Picture1.ScaleWidth / 2, Picture1.ScaleHeight / 2)-(Picture1.ScaleWidth / 2, -Picture1.ScaleHeight / 2)
Text1 = 100
Text2 = 0.01
End Sub

Option Explicit

Private Sub Comman