函数图形程度.用Pset方法在图形框Picture内绘制y=sinx在-3.14到3.14之间的图形
答案:2 悬赏:30 手机版
解决时间 2021-02-23 14:32
- 提问者网友:未信
- 2021-02-23 00:26
函数图形程度.用Pset方法在图形框Picture内绘制y=sinx在-3.14到3.14之间的图形
最佳答案
- 五星知识达人网友:过活
- 2021-02-23 02:04
窗体上添加一个图片框,一个命令按钮
图片框的scaleheight和scalewidth属性的值均为10
scalemode属性的值为7
代码如下:
Private Sub Command1_Click()
Const pi = 3.1415926
Dim x, y
Picture1.Scale (-5, 5)-(5, -5) '画坐标轴
Picture1.Line (-4, 0)-(4, 0)
Picture1.Line (0, -4)-(0, 4)
Picture1.CurrentX = 0
Picture1.CurrentY = 0
Picture1.Print "(0,0)"
For x = -1 * pi To pi Step pi / 10000
y = Sin(x)
Picture1.PSet (x, y)
Picture1.Line -(x, y)
Next x
Picture1.CurrentX = -1 * pi
Picture1.CurrentY = 0
Picture1.Print "(-π,0)"
Picture1.CurrentX = pi
Picture1.CurrentY = 0
Picture1.Print "(π,0)"
End Sub
图片框的scaleheight和scalewidth属性的值均为10
scalemode属性的值为7
代码如下:
Private Sub Command1_Click()
Const pi = 3.1415926
Dim x, y
Picture1.Scale (-5, 5)-(5, -5) '画坐标轴
Picture1.Line (-4, 0)-(4, 0)
Picture1.Line (0, -4)-(0, 4)
Picture1.CurrentX = 0
Picture1.CurrentY = 0
Picture1.Print "(0,0)"
For x = -1 * pi To pi Step pi / 10000
y = Sin(x)
Picture1.PSet (x, y)
Picture1.Line -(x, y)
Next x
Picture1.CurrentX = -1 * pi
Picture1.CurrentY = 0
Picture1.Print "(-π,0)"
Picture1.CurrentX = pi
Picture1.CurrentY = 0
Picture1.Print "(π,0)"
End Sub
全部回答
- 1楼网友:酒安江南
- 2021-02-23 03:04
窗体上添加一个图片框,一个命令按钮图片框的scaleheight和scalewidth属性的值均为10scalemode属性的值为7代码如下:privatenbsp;subnbsp;command1_click()constnbsp;pinbsp;=nbsp;3.1415926dimnbsp;x,nbsp;ypicture1.scalenbsp;(-5,nbsp;5)-(5,nbsp;-5)nbsp;‘画坐标轴picture1.linenbsp;(-4,nbsp;0)-(4,nbsp;0)picture1.linenbsp;(0,nbsp;-4)-(0,nbsp;4)picture1.currentxnbsp;=nbsp;0picture1.currentynbsp;=nbsp;0picture1.printnbsp;“(0,0)“fornbsp;xnbsp;=nbsp;-1nbsp;*nbsp;pinbsp;tonbsp;pinbsp;stepnbsp;pinbsp;/nbsp;10000nbsp;nbsp;nbsp;nbsp;ynbsp;=nbsp;sin(x)nbsp;nbsp;nbsp;nbsp;picture1.psetnbsp;(x,nbsp;y)nbsp;nbsp;nbsp;nbsp;picture1.linenbsp;-(x,nbsp;y)nextnbsp;xpicture1.currentxnbsp;=nbsp;-1nbsp;*nbsp;pipicture1.currentynbsp;=nbsp;0picture1.printnbsp;“(-π,0)“picture1.currentxnbsp;=nbsp;pipicture1.currentynbsp;=nbsp;0picture1.printnbsp;“(π,0)“endnbsp;sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯