计算动画数量

时间:2015-10-30 20:00:00

标签: winforms animation

我想创建一个像Countup.js这样的计数/倒计时动画。标签有可能吗?任何指针都将非常感激。

1 个答案:

答案 0 :(得分:-1)

Here's a very simple example of that concept using a form with two textboxes (start and end) a display label. As it gets closer to the end target, the ease gets higher and the process slows down.

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Dim cntr As Integer = CInt(Me.txtStart.Text)
    Dim ease As Integer = 0
    Do While cntr < Me.txtEnd.Text
        cntr += 1

        Me.lblCount.Text = cntr
        Me.lblCount.Refresh()

        Select Case Me.txtEnd.Text - cntr
            Case Is < 5
                ease = 100
            Case Is < 10
                ease = 40
            Case Is < 100
                ease = 10
            Case Is < 200
                ease = 1
        End Select

        If ease > 0 Then
            System.Threading.Thread.Sleep(ease)
        End If
    Loop
End Sub