'宣言 Public Event Moving As EventHandler(Of MovingEventArgs)
public event EventHandler<MovingEventArgs> Moving
イベント ハンドラが、このイベントに関連するデータを含む、MovingEventArgs 型の引数を受け取りました。次の MovingEventArgs プロパティには、このイベントの固有の情報が記載されます。
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"); }