360教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

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

时间:2024/7/15作者:未知来源:360教程人气:

[摘要]Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butto...
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




关键词:正弦函数的绘制的一种办法




Copyright © 2012-2018 360教程(http://www.360sd.cn) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版