0

我试图弄清楚如何使用 VB.NET 为 WPF 中的元素设置动画/移动。有人建议我尝试使用 CompositionTarget.Rendering,但我很难开始。下面是我的代码,下面是我收到的错误消息。有人可以告诉我哪里出错了。

代码:

Imports System.ComponentModel

Class MainWindow

    Dim flake0 As New flake

    Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        canvas1.DataContext = flake0
        AddHandler CompositionTarget.Rendering, AddressOf compo
    End Sub

    Private Sub compo(ByVal sender As Object, ByVal e As EventArgs)
        flake0.move()
    End Sub
End Class

错误:

Handles clause requires a WithEvents variable defined in the containing type or one of its base types
4

1 回答 1

0

我有另一种方法意外地将“句柄 CompositionTarget.Rendering”标记到它的末尾。

于 2012-12-04T01:08:57.490 回答