要是我做:小钟自己画(比如5幅画面存在资源文件里),用timer1控制小钟的动画效果,在Picture1中放一个shape1,形成进度条。
新的一题开始时:
Shape1.Width=0
Timer1.Enabled=TruePrivate Sub Timer1_Timer()
Static ImageID As Long
Dim shpWidth As Long
picClock.Picture=LoadResPicture(ImageID,0)
If ImageID=4 Then ImageID=0 Else ImageID=ImageID+1
shpWidth=Shape1.Width
If shpWidth=Picture1.Width Then
Timer1.Enable=False
Else
Shape1.Width=shpWidth +15
End If
End Sub
新的一题开始时:
Shape1.Width=0
Timer1.Enabled=TruePrivate Sub Timer1_Timer()
Static ImageID As Long
Dim shpWidth As Long
picClock.Picture=LoadResPicture(ImageID,0)
If ImageID=4 Then ImageID=0 Else ImageID=ImageID+1
shpWidth=Shape1.Width
If shpWidth=Picture1.Width Then
Timer1.Enable=False
Else
Shape1.Width=shpWidth +15
End If
End Sub
你说的小钟不是VB的控件,他是通过VB中的时钟(Timer)控件来实现的,通过调节Timer的Interval属性来实现时间的调节.我有一个利用时钟控件写的一个小程序,代码如下,看了以后,举一反三,应该就明白了.
至于小钟的动画效果,无非多加几副图而已.
Private Sub StartCmd_Click()
On Error GoTo errhandler
If StartCmd.Tag = 0 Then
Timer1.Interval = Text1.Text '自己输入的闪烁间隔
Timer1.Enabled = True '时钟开始
StartCmd.Caption = "停止"
StartCmd.Tag = 1
Else
StartCmd.Tag = 0
Timer1.Enabled = False
StartCmd.Caption = "开始"
End If
errhandler:
Exit Sub
End SubPrivate Sub ChangeColor()
If BackGround.Tag = 0 Then
Green.Visible = False
Red.Visible = True
BackGround.Tag = 1
Else
BackGround.Tag = 0
Green.Visible = True
Red.Visible = False
End If
End SubPrivate Sub Timer1_Timer()
Call ChangeColor
End Sub还有不明白告我EMAIL,我给你发过去.