正弦函数的绘制的一种方法

时间:2007-01-21 14:07:39   来源:  作者:  点击:次  出处:技术无忧
关键字:正弦

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

 

        Dim G As Graphics

 

        G = PictureBox1.CreateGraphics()

        '移动坐标原点(那么原点下就变成了(20,pictruebox1.height/2))

        G.TranslateTransform(20, PictureBox1.Height / 2)

        '绘制X轴与Y

        'Y

        G.DrawLine(Pens.Black, 20, -PictureBox1.Height / 2, 20, PictureBox1.Height / 2)

        'X

        G.DrawLine(Pens.Black, -20, 0, PictureBox1.Width, 0)

        '正弦函数

        Dim X, Y As Double

        For X = 0 To 400 Step 0.002

            Y = 60 * Math.Sin(2 * 3.1415926 * X / 200)

            G.DrawLine(Pens.Blue, CInt(X), 0, CInt(X), CInt(Y))

            Application.DoEvents()

        Next

        For X = 0 To 400 Step 0.002

            Y = 60 * Math.Sin(2 * 3.1415926 * X / 200)

            G.DrawLine(Pens.Red, CInt(X), 0, CInt(X), CInt(Y))

            Application.DoEvents()

        Next

    End Sub

你有email邮箱吗?经常收到垃圾邮件而烦吗?立即使用邮箱LOGO在线制作酷Email logo图片


相关文章

    无相关信息

文章评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

300x250广告位招租