示意图:

示意图:
源码如下,请先试着自已编写,实在不行的话就花10块钱看看吧。。。
[UseMoney=10]
Option Explicit
Dim dx As Integer, dy As Integer '声明两个变量,dx为横向步进大小,dy为纵向步进大小
Private Sub Form_Load() '在Form_Load中初始化dx,dy两个变量 dx = 50 dy = 50 End Sub
Private Sub Form_Resize() '窗体大小发生变化后,将小球移到窗体中间 Shape1.Move Me.ScaleWidth / 2, Me.ScaleHeight / 2 End Sub
Private Sub Timer1_Timer() '控制小球运行,靠边时反疿 If Shape1.Left <= 0 Or Shape1.Left + Shape1.Width >= Me.ScaleWidth Then dx = -dx If Shape1.Top <= 0 Or Shape1.Top + Shape1.Height > Me.ScaleHeight Then dy = -dy Shape1.Move Shape1.Left + dx, Shape1.Top + dy End Sub
[/UseMoney]
花钱花的值啊!
也不是很难啊!
我刚做的
Dim inta As Integer
Private Sub Form_Load()
inta = 100
End Sub
Private Sub Timer1_Timer()
s.Left = s.Left - inta If s.Left <= 0 Then inta = inta - 200 End If If s.Left >= Me.Width + s.Width Then inta = 200 + inta End If End Sub