'Declaration Public Event Moving As EventHandler(Of MovingEventArgs)
public event EventHandler<MovingEventArgs> Moving
The event handler receives an argument of type MovingEventArgs containing data related to this event. The following MovingEventArgs properties provide information specific to this event.
AddHandler DialogWindow.Moving, AddressOf DialogWindow_Moving Private Sub DialogWindow_Moving(ByVal sender As System.Object, ByVal e As MovingEventArgs) 'Don't allow the dialog window to move more than 200 pixels If (e.Left > 200) Then e.Cancel = True System.Diagnostics.Debug.WriteLine("Moving Cancelled") Return End If System.Diagnostics.Debug.WriteLine("Dialog Window Moving Successfully") End Sub
DialogWindow.Moving += new EventHandler<MovingEventArgs>(DialogWindow_Moving); ... void DialogWindow_Moving(object sender, MovingEventArgs e) { //Don't allow the dialog window to move more than 200 pixels if (e.Left > 200) { e.Cancel = true; System.Diagnostics.Debug.WriteLine("Moving Cancelled"); return; } System.Diagnostics.Debug.WriteLine("Dialog Window Moving Successfully"); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2