VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Draws a random coloured line when you move the mouse

by Neggster (4 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 25th January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Draws a random coloured line when you move the mouse

Rate Draws a random coloured line when you move the mouse



'"Lines" By neggster
'Date: January 25 2002
'Requires: Nothing but the code!

Private Sub Form_Load()
Me.BorderStyle = 0 'set the form to have no border
Me.WindowState = 2 'maximize the window
Me.BackColor = black 'set the background colour to black
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Unload Me 'close the window when you click
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
X = X 'get the x coordinate
Y = Y 'get the y coordinate
r = Rnd * 255 'select a random red value
g = Rnd * 255 'select a random green value
b = Rnd * 255 'select a random blue value
Me.Line (X, Y)-Step(X, Y), RGB(r, g, b) 'draw the line
End Sub



Download this snippet    Add to My Saved Code

Draws a random coloured line when you move the mouse Comments

No comments have been posted about Draws a random coloured line when you move the mouse. Why not be the first to post a comment about Draws a random coloured line when you move the mouse.

Post your comment

Subject:
Message:
0/1000 characters