当前位置:编程学习 > VB >>

vb.net 绘制sin函数

[vb] 
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 

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

 \
 

补充:软件开发 , Vb ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,