Assembly: System.Windows.Forms (in system.windows.forms.dll)
You will want to use HandledMouseEventArgs primarily when developing a control that needs to handle mouse wheel events itself, and prevent them from being seen by the control's immediate parent container. HandledMouseEventArgs is not passed directly by MouseEventHandler when it handles the MouseWheel event. Rather, MouseEventHandler uses a MouseEventArgs, which you must cast to a HandledMouseEventArgs in order to cancel an occurrence of MouseWheel.
The following code example demonstrates how to mark the mouse wheel event as handled in a custom control.
Public Class MouseWheelControl Sub New() ' Add initialization code for the control here. End Sub Protected Sub MouseWheelControl_MouseWheel(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseWheel Dim Hme As HandledMouseEventArgs = e Hme.Handled = True ' Perform custom mouse wheel action here. End Sub End Class
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.