Jun 10th, 2002, 03:39 AM
SetPixel() : An Interesting Example
Enclosed is an example of using SetPixel().
This example, which I like to call 'flies', creates a black picturebox.
Then once you click inside the PictureBox, it will create what looks like lots of flies.
When you move the mouse cursor around they try to get away from the cursor.
I think it looks quite nice
If you have any queries or comments, just let me know.
Oct 21st, 2004, 08:49 AM
* 21-October-2004 - Moved to CodeBank *
Oct 22nd, 2004, 03:31 PM
Just spent 10 minutes messing with it.
(the program that is)
I don't live here any more.
Oct 22nd, 2004, 03:40 PM
Actually I forgot what that app did. God that is so much fun
Nov 15th, 2004, 05:55 AM
Nov 15th, 2004, 10:12 PM
area around cursor
i tried to change the area around the cursor to a box but it still behaves like as if it was a circle???
Nov 16th, 2004, 03:38 AM
The flies' positions are goverened by this:
For i = 0 To UBound(pixels) - 1
'' some code
If distanceBetweenTwoPoints(pos, .pos) < 25 Then
Do Until (distanceBetweenTwoPoints(pos, .pos) > 35)
.x = .x + (2 * Rnd)
.Y = .Y + (2 * Rnd)
'' some code
Private Function distanceBetweenTwoPoints(ByRef point1 As pointapi, ByRef point2 As pointapi) As Single
distanceBetweenTwoPoints = (((point2.x - point1.x) ^ 2) + ((point2.Y - point1.Y) ^ 2)) ^ 0.5
Click Here to Expand Forum to Full Width
Survey posted by VBForums.