求助,用vb.net2010怎么画正弦波
如题,怎么实现正弦波的不断传输过程啊?急求啊! VB.NET
[解决办法]
想让正弦线同步传输的话用一个timer实现数据的实时更新,但是上面的函数就得改了
Public Class Form1
Public G As Graphics
Public Sub DrawSinLin(ByVal High As Double, ByVal LoucationY As Double, v As Integer)
G = Me.PictureBox1.CreateGraphics()
Dim PS(500) As Point
Dim I
For I = 0 To 500
PS(I).X = I * 2.1
PS(I).Y = LoucationY - 10 * Math.Cos(I / 10) * High + 10 * High
PS(I).X = PS(I).X + v
Next I
Dim x As Integer = Me.PictureBox1.Width / 2
Dim y As Integer = Me.PictureBox1.Height / 2 + 20
G.DrawLines(Pens.Red, PS)
End Sub
Dim i
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
i += 5 '5是速度自己设定
G = Me.PictureBox1.CreateGraphics
G.Clear(Color.Blue)
Call DrawSinLin(5, 100, i)
End Sub
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
Timer1.Start()
End Sub
End Class