|
Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Partial Public Class Target
Public Points As Integer
Public Sub New()
MyBase.New()
Me.InitializeComponent()
' Insert code required on object creation below this point.
End Sub
Private Sub HitTarget(ByVal e As System.Windows.Input.MouseButtonEventArgs)
Dim x As Double = e.GetPosition(TargetCanvas).X
Dim y As Double = e.GetPosition(TargetCanvas).Y
Dim dent As New Dent()
Canvas.SetLeft(dent, x)
Canvas.SetTop(dent, y)
TargetCanvas.Children.Add(dent)
End Sub
Private Sub MainArea_MouseLeftButtonDown(ByVal sender As Object, _
ByVal e As System.Windows.Input.MouseButtonEventArgs) _
Handles MainArea.MouseLeftButtonDown
HitTarget(e)
End Sub
Private Sub GreenZone_MouseLeftButtonDown(ByVal sender As Object, _
ByVal e As System.Windows.Input.MouseButtonEventArgs) _
Handles GreenZone.MouseLeftButtonDown
HitTarget(e)
Points = 7
End Sub
Private Sub BlueZone_MouseLeftButtonDown(ByVal sender As Object, _
ByVal e As System.Windows.Input.MouseButtonEventArgs) _
Handles BlueZone.MouseLeftButtonDown
HitTarget(e)
Points = 8
End Sub
Private Sub YellowZone_MouseLeftButtonDown(ByVal sender As Object, _
ByVal e As System.Windows.Input.MouseButtonEventArgs) _
Handles YellowZone.MouseLeftButtonDown
HitTarget(e)
Points = 9
End Sub
Private Sub RedZone_MouseLeftButtonDown(ByVal sender As Object, _
ByVal e As System.Windows.Input.MouseButtonEventArgs) _
Handles RedZone.MouseLeftButtonDown
HitTarget(e)
Points = 10
End Sub
Public Sub PlayStoryboard()
Dim targeter As Storyboard
targeter = CType(Me.Resources("TargetStoryboard"), Storyboard)
targeter.Begin(Me)
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.