vb.net 绘制sin函数

Public Class Form1

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim G As Graphics
        G = Me.CreateGraphics()
        Dim PS(1000) As Point
        Dim I
        For I = 0 To 1000
            PS(I).X = I
            PS(I).Y = Me.Height / 2 - 10 * Math.Sin(I / 10)
        Next I
        Dim x As Integer = Me.ClientSize.Width / 2
        Dim y As Integer = Me.ClientSize.Height / 2 + 20
        G.DrawLine(Pens.Red, x, 100, x, 200)
        G.DrawLine(Pens.Red, 0, y, 300, y)
        G.DrawLines(Pens.Red, PS)
    End Sub
End Class


posted @ 2013-05-02 19:13  xinyuyuanm  阅读(443)  评论(0编辑  收藏  举报