Private Sub DrawWavedText(ByVal obj As Object, ByVal txt As _
String, ByVal x0 As Single, ByVal y0 As Single, _
Optional ByVal draw_above As Boolean, Optional ByVal _
draw_curve As Boolean = False)
Dim i As Integer
Dim ch As String
Dim y_offset As Single
Dim x1 As Single
Dim y1 As Single
Dim x2 As Single
Dim y2 As Single
If draw_above Then
y_offset = -obj.TextHeight("X")
Else
y_offset = 0
End If
x1 = x0
y1 = F(x1) + y0
x2 = x1
y2 = y1
For i = 1 To Len(txt)
' Draw the next character.
obj.CurrentX = x2
obj.CurrentY = y2 + y_offset
ch = Mid$(txt, i, 1)
obj.Print ch;
' Draw the line on the curve if desired.
If draw_curve Then
obj.Line (x1, y1)-(x2, y2)
End If
' Move to the next point.
x1 = x2
y1 = y2
x2 = x2 + obj.TextWidth(ch)
y2 = F(x2) + y0
Next i
End Sub
Private Function F(ByVal x As Single) As Single
F = MAX * Sin(x / 250)
End Function
|