|
-
Aug 29th, 2012, 08:08 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Modify code to make floating Pictue stay within form boundries
How can i modify this code so picture does not disappear off the form
Sub MovePic()
Dim x As Single, y As Single, velocity As Single, angle As Single, vangle As Single
CenterPic
Me.picJackpot.ZOrder 0
velocity = 2
angle = Rnd * 6.283
x = picJackpot.Left: y = picJackpot.Top
Do
If Rnd < 0.1 Then vangle = (Rnd - 0.5) * 0.5 'Change direction velocity randomly 10%chance
angle = angle + (vangle + 6.283) Mod 6.283 'change direction
x = x + Cos(angle) * velocity 'move position
y = y + Sin(angle) * velocity
picJackpot.Move x, y 'move image
DoEvents 'threading
Loop While mStopJackPot = False 'Forms.Count Or yourchoise
End Sub
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|