vb.net 绘制sin函数

前端之家收集整理的这篇文章主要介绍了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,200)
        G.DrawLine(Pens.Red,y,300,y)
        G.DrawLines(Pens.Red,PS)
    End Sub
End Class

猜你在找的VB相关文章