1,451
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command1_Click()
Timer1.Interval = 100
Timer1.Enabled = Not (Timer1.Enabled)
End Sub
Private Sub MyLines()
'直线例子
myWaveLine Picture1, 100, 30, 200, 30, 10, 10
'不同分段例子
myWaveLine Picture1, 100, 50, 200, 50, 10, 4
'方向例子
myWaveLine Picture1, 200, 70, 100, 70, 10, 4
'加粗例子
myWaveLine Picture1, 100, 100, 200, 100, 20, 5
'折线例子
myWaveLine Picture1, 100, 120, 180, 200, 20, 10
myWaveLine Picture1, 180, 200, 260, 120, 20, 10
End Sub
Private Sub myWaveLine(obj As Object, x1 As Long, y1 As Long, x2 As Long, y2 As Long, intWidth As Integer, intsplit As Integer)
Static intWave As Long
Dim i As Long
Dim j As Integer
Dim xS As Long, yS As Long
obj.DrawWidth = intWidth
For i = 0 To intsplit - 1
xS = x1 + (x2 - x1) / intsplit * i
yS = y1 + (y2 - y1) / intsplit * i
For j = 0 To 9
obj.Line (xS + (x2 - x1) / 10 / intsplit * j, yS + (y2 - y1) / 10 / intsplit * j)-(xS + (x2 - x1) / 10 / intsplit * (j + 1), yS + (y2 - y1) / 10 / intsplit * (j + 1)), RGB(0, 0, 255 * Cos(((xS + (x2 - x1) / 100 * j + intWave) Mod intsplit) / intsplit * 3.14 / 2))
Next
Next
intWave = intWave + 1
End Sub
Private Sub Form_Load()
Me.ScaleMode = 3
Me.Picture1.ScaleMode = 3
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
Call MyLines
Timer1.Enabled = True
End Sub