Mega Code Archive
Make an object follow the mouse pointer as it moves on the screen
//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Shapes
Imports System.Windows.Input
Namespace WpfApplication1
Public Partial Class Window1
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub MouseMoveHandler(sender As Object, e As MouseEventArgs)
' Get the x and y coordinates of the mouse pointer.
Dim position As Point = e.GetPosition(Me)
Dim pX As Double = position.X
Dim pY As Double = position.Y
ellipse.Width = pX
ellipse.Height = pY
End Sub
End Class
End Namespace