iA piece of internet history. AllAPI.net was made by two Belgian brothers, still in their teens, from 1998 to 2002, and at its peak 180,000 programmers a month came here. We keep it online exactly as it was. Nothing here is maintained anymore.
AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 


Creating Rainbow Text

This week I will show you a useful tip that is very simple to do and very effective.

You may have seen programs that have multicoloured (Rainbow) text in the background.

Well this is very simple to do using a for loop.

Code

1. Start a new Standard Exe project; form1 is created by default

2. Type in the following code.

Sub Form_Paint()
Dim I As Integer, X As Integer, Y As Integer
Dim C As String
Cls
For I = 0 To 91
X = CurrentX
Y = CurrentY
C = Chr(I)
'Line -(X + TextWidth(C), Y = TextHeight(C)), _
QBColor(Rnd * 16), BF
CurrentX = X
CurrentY = Y
ForeColor = RGB(Rnd * 256, Rnd * 256, Rnd * 256)
Print "Hello World Hello World Hello World Hello"
Next
End Sub  

3. Run the program by pressing F5 or choosing start from the run program and watch the form fill with lots of multi-coloured text

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
This site is located at http://allapi.mentalis.org/