0
我想弄清楚如何使用VB.NET動畫/移動WPF中的元素。有人建議我嘗試使用CompositionTarget.Rendering,但我很難入門。下面是我的代碼,下面是我收到的錯誤消息。有人可以告訴我我哪裏去錯了。試圖在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