嗨,我很抱歉提出'虚假问题'。我有一个类,它必须使我的工作区(PictureBox)无效以执行一些动作。但我无法做到,因为它完全没有运行。
我的课程:
Public Class clsLayoutObject
Private tmrAnimation As New Timer
Public oID As UInteger
Public oName As String
Public oGraphic As New List(Of Image)
Public oMaxFrame As UInteger
Public oActiveFrame As UInteger
Public oFrameRate As UInteger = 100
Public oX As Integer, oY As Integer
Public oWidth As Integer, oHeight As Integer
Public oDepth As UInteger
Public oLocked As Boolean
Public oVisible As Boolean
Private tempActiveFrame As UInteger
Private Sub playAnimation()
AddHandler tmrAnimation.Elapsed, New ElapsedEventHandler(AddressOf animationPlayback)
tmrAnimation.Interval = oFrameRate
tmrAnimation.Start()
tempActiveFrame = oActiveFrame
End Sub
Private Sub animationPlayback()
--> frmmain.Workspace.Invalidate()
If oActiveFrame < oMaxFrame Then
oActiveFrame += 1
Else
oActiveFrame = 0
End If
End Sub
Private Sub animationPause()
tmrAnimation.Stop()
frmmain.Workspace.Invalidate()
End Sub
Private Sub animationStop()
oActiveFrame = tempActiveFrame
tmrAnimation.Stop()
frmmain.Workspace.Invalidate()
End Sub
End Class
我对OO编程不太熟悉,而且我还在改进。感谢。