Visual Basic NET ( 3)


- 4


' :

x = ..Left + ..Width * 3 / 4

y = ..Top + ..Height / 2

____()

' :

dx = _ * (1 - 2 * Rnd()) ' _

dy = _ * (1 - 2 * Rnd()) ' _

End Sub

Private Sub ____()

.pict(_).Left = x

.pict(_).Top = y

End Sub

Public Sub () ' ,

If () Then ___() ' , ,

() ', ,

() ', ,

____()

End Sub

 

Private Sub ()

x = x + dx

y = y + dy

End Sub

 

Private Sub () '

If ___() Then dy = -dy '

If ___() Then dx = -dx '

End Sub

 

Private Function ___() As Boolean

If y < ..Top Or y + _ > ..Top + ..Height Then

Return True

Else

Return False

End If

End Function

 

Private Function ___() As Boolean

If x < ..Left Or x + _ > ..Left + ..Width Then

Return True

Else

Return False