Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

HandledMouseEventArgs Class

Allows a custom control to prevent the MouseWheel event from being sent to its parent container.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public class HandledMouseEventArgs : MouseEventArgs
public class HandledMouseEventArgs extends MouseEventArgs
public class HandledMouseEventArgs extends MouseEventArgs
Not applicable.

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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 Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.