vb中picturebox控件波形曲线代码
1个回答
展开全部
'使用PSet 方法
'假设你的波形曲线有正弦曲线,余弦曲线,正弦曲线+余弦曲线三条
Private Sub Command1_Click()
Dim jiao As Single
Picture1.Cls
jiao = 4 * Atn(1) 'Atn(1)=90度.即π/4弧度
Picture1.Scale (-9, 6)-(9, -6)
Picture1.Line (-9, 0)-(9, 0)
Picture1.Line (0, -6)-(0, 6)
For i = -2 * jiao To 2 * jiao Step 0.001
Picture1.ForeColor = RGB(255, 0, 0)
Picture1.PSet (i, Sin(i))
Picture1.ForeColor = RGB(0, 255, 0)
Picture1.PSet (i, Cos(i))
Picture1.ForeColor = RGB(0, 0, 255)
Picture1.PSet (i, Sin(i) + Cos(i))
Next i
End Sub
Private Sub Form_Load()
Picture1.Width = 9000
Picture1.Height = 6000
Label1(0).ForeColor = RGB(0, 0, 0)
Label1(0).Caption = "图例"
Label1(1).ForeColor = RGB(255, 0, 0)
Label1(1).Caption = "■sin(x)"
Label1(2).ForeColor = RGB(0, 255, 0)
Label1(2).Caption = "■cox(x)"
Label1(3).ForeColor = RGB(0, 0, 255)
Label1(3).Caption = "■sin(x)+cox(x)"
End Sub
'假设你的波形曲线有正弦曲线,余弦曲线,正弦曲线+余弦曲线三条
Private Sub Command1_Click()
Dim jiao As Single
Picture1.Cls
jiao = 4 * Atn(1) 'Atn(1)=90度.即π/4弧度
Picture1.Scale (-9, 6)-(9, -6)
Picture1.Line (-9, 0)-(9, 0)
Picture1.Line (0, -6)-(0, 6)
For i = -2 * jiao To 2 * jiao Step 0.001
Picture1.ForeColor = RGB(255, 0, 0)
Picture1.PSet (i, Sin(i))
Picture1.ForeColor = RGB(0, 255, 0)
Picture1.PSet (i, Cos(i))
Picture1.ForeColor = RGB(0, 0, 255)
Picture1.PSet (i, Sin(i) + Cos(i))
Next i
End Sub
Private Sub Form_Load()
Picture1.Width = 9000
Picture1.Height = 6000
Label1(0).ForeColor = RGB(0, 0, 0)
Label1(0).Caption = "图例"
Label1(1).ForeColor = RGB(255, 0, 0)
Label1(1).Caption = "■sin(x)"
Label1(2).ForeColor = RGB(0, 255, 0)
Label1(2).Caption = "■cox(x)"
Label1(3).ForeColor = RGB(0, 0, 255)
Label1(3).Caption = "■sin(x)+cox(x)"
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询