' Draw the string with each character a different
' color shading from RGB(start_r, start_g, start_b) to
' RGB(end_r, end_g, end_b).
Private Sub ShadeString(ByVal canvas As Object, ByVal _
start_x As Single, ByVal start_y As Single, ByVal _
start_r As Integer, ByVal start_g As Integer, ByVal _
start_b As Integer, ByVal end_r As Integer, ByVal end_g _
As Integer, ByVal end_b As Integer, ByVal TXT As String)
Dim r As Single
Dim g As Single
Dim b As Single
Dim dr As Single
Dim dg As Single
Dim db As Single
Dim txt_len As Integer
Dim i As Integer
txt_len = Len(TXT)
dr = (end_r - start_r) / (txt_len - 1)
dg = (end_g - start_g) / (txt_len - 1)
db = (end_b - start_b) / (txt_len - 1)
r = start_r
g = start_g
b = start_b
canvas.CurrentX = start_x
canvas.CurrentY = start_y
For i = 1 To txt_len
canvas.ForeColor = RGB(r, g, b)
canvas.Print Mid$(TXT, i, 1);
r = r + dr
g = g + dg
b = b + db
Next i
End Sub
|