|
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
|