-
I'm trying to create a screen saver, where a line flys on the screen!
I have tried the following code, but after a few loops, the edges of the line disapear outside the screen, and so does the line after some time.....
Does anyone know how to make a line fly INSIDE the screen??
Code:
Form1.Show
Dim Scr
For Scr = 1 To 1
Do
Line1.x1 = Line1.x1 + 34
Line1.x2 = Line1.x2 - 45
Line1.y1 = Line1.y1 + 24
Line1.y2 = Line1.y2 + 15
pausetime = 0.5
start = Timer
Do While Timer < start + pausetime
DoEvents
Loop
Line1.x1 = Line1.x1 - 30
Line1.x2 = Line1.x2 - 80
Line1.y1 = Line1.y1 + 20
Line1.y2 = Line1.y2 - 15
pausetime = 0.5
start = Timer
Do While Timer < start + pausetime
DoEvents
Loop
Line1.x1 = Line1.x1 + 300
Line1.x2 = Line1.x2 - 80
Line1.y1 = Line1.y1 - 20
Line1.y2 = Line1.y2 + 150
start = Timer
Do While Timer < start + pausetime
DoEvents
Loop
Line1.x1 = 4320
Line1.x2 = 4320
Line1.y1 = 2040
Line1.y2 = 3720
Loop
Next Scr
-
<?>
Code:
I've used this to keep a form on the screen
You should be able to doctor it to use on a control
Option Explicit
'you could do it this way / add a timer control
Private Sub Form_Load()
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
If ((Form1.Left) < 0) Then Form1.Left = 0
If ((Form1.Top) < 0) Then Form1.Top = 0
If ((Form1.Left) > Screen.Width - Form1.Width) _
Then Form1.Left = Screen.Width - Form1.Width
If ((Form1.Top) > Screen.Height - Form1.Height) _
Then Form1.Top = Screen.Height - Form1.Height
End Sub