怎么用VB画函数图像?

怎么用VB画函数图像?


跃然一笑
浏览 888回答 2
2回答

慕婉清6462132

1、先定义坐标系,即XY轴。2、根据具体需要,调用内部函数,或自定义函数,绘制函数图像。3、代码供参考:Me.AutoRedraw = TrueMe.Width = 8000: Me.Height = 6000Me.Scale (-10, 2)-(10, -2)Line (0, -2)-(0, 2)Line (-20, 0)-(20, 0)For i! = -2 To 2 Step 0.5Line (0, i)-(0.5, i)CurrentX = -1.8CurrentY = iPrint iNext iFor j! = -8 To 10 Step 2Line (j, 0)-(j, 0.05)CurrentX = j - 0.5CurrentY = 0If Abs(j) > 0 Then Print jNext jFor k = -10 To 10 Step 0.01PSet (k, Sin(k)), vbRedPSet (k, Cos(k)), vbBlueNext k

蝴蝶不菲

用描点的方法吧Form1.PSet (x, Sin(x))Private Const PI = 3.14159265358979Private Sub Command1_Click()w = 5 * PIh = w * Picture1.Height / Picture1.WidthPicture1.Scale (-w, h)-(w, -h)k = Picture1.ScaleWidth / Picture1.WidthDebug.Print Picture1.WidthPicture1.Line (-w, 0)-(w, 0)Picture1.Line (0, -h)-(0, h)For x = -2 * PI To 2 * PI Step kPicture1.PSet (x, Sin(x))NextEnd Sub
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Oracle