HandledMouseEventArgs HandledMouseEventArgs HandledMouseEventArgs HandledMouseEventArgs Class

定义

允许自定义控件防止将 MouseWheel 事件发送到它的父容器。Allows a custom control to prevent the MouseWheel event from being sent to its parent container.

public ref class HandledMouseEventArgs : System::Windows::Forms::MouseEventArgs
public class HandledMouseEventArgs : System.Windows.Forms.MouseEventArgs
type HandledMouseEventArgs = class
    inherit MouseEventArgs
Public Class HandledMouseEventArgs
Inherits MouseEventArgs
继承
HandledMouseEventArgsHandledMouseEventArgsHandledMouseEventArgsHandledMouseEventArgs
派生

示例

下面的代码示例演示如何将标记为已处理的自定义控件中的鼠标滚轮事件。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

注解

想要使用HandledMouseEventArgs主要在开发需要处理的鼠标滚轮事件本身,并防止他们看到的控件的直接父容器的控件时。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 不直接通过传递MouseEventHandler时,它处理MouseWheel事件。HandledMouseEventArgs is not passed directly by MouseEventHandler when it handles the MouseWheel event. 而是MouseEventHandler使用MouseEventArgs,必须强制转换为HandledMouseEventArgs才能取消发生MouseWheelRather, MouseEventHandler uses a MouseEventArgs, which you must cast to a HandledMouseEventArgs in order to cancel an occurrence of MouseWheel.

构造函数

HandledMouseEventArgs(MouseButtons, Int32, Int32, Int32, Int32) HandledMouseEventArgs(MouseButtons, Int32, Int32, Int32, Int32) HandledMouseEventArgs(MouseButtons, Int32, Int32, Int32, Int32) HandledMouseEventArgs(MouseButtons, Int32, Int32, Int32, Int32)

通过指定的鼠标按钮、鼠标按钮单击次数、水平和垂直屏幕坐标以及鼠标指针位置的变化对 HandledMouseEventArgs 类的新实例进行初始化。Initializes a new instance of the HandledMouseEventArgs class with the specified mouse button, number of mouse button clicks, horizontal and vertical screen coordinates, and the change of mouse pointer position.

HandledMouseEventArgs(MouseButtons, Int32, Int32, Int32, Int32, Boolean) HandledMouseEventArgs(MouseButtons, Int32, Int32, Int32, Int32, Boolean) HandledMouseEventArgs(MouseButtons, Int32, Int32, Int32, Int32, Boolean) HandledMouseEventArgs(MouseButtons, Int32, Int32, Int32, Int32, Boolean)

通过指定的鼠标按钮、鼠标按钮单击次数、水平和垂直屏幕坐标、鼠标指针位置的变化以及指示事件是否已处理的值对 HandledMouseEventArgs 类的新实例进行初始化。Initializes a new instance of the HandledMouseEventArgs class with the specified mouse button, number of mouse button clicks, horizontal and vertical screen coordinates, the change of mouse pointer position, and the value indicating whether the event is handled.

属性

Button Button Button Button

获取曾按下的是哪个鼠标按钮。Gets which mouse button was pressed.

(Inherited from MouseEventArgs)
Clicks Clicks Clicks Clicks

获取按下并释放鼠标按钮的次数。Gets the number of times the mouse button was pressed and released.

(Inherited from MouseEventArgs)
Delta Delta Delta Delta

获取鼠标轮已转动的制动器数的有符号计数乘以 WHEEL_DELTA 常数。Gets a signed count of the number of detents the mouse wheel has rotated, multiplied by the WHEEL_DELTA constant. 制动器是鼠标轮的一个凹口。A detent is one notch of the mouse wheel.

(Inherited from MouseEventArgs)
Handled Handled Handled Handled

获取或设置是否应将此事件转发到控件的父容器。Gets or sets whether this event should be forwarded to the control's parent container.

Location Location Location Location

获取鼠标在产生鼠标事件时的位置。Gets the location of the mouse during the generating mouse event.

(Inherited from MouseEventArgs)
X X X X

获取鼠标在产生鼠标事件时的 x 坐标。Gets the x-coordinate of the mouse during the generating mouse event.

(Inherited from MouseEventArgs)
Y Y Y Y

获取鼠标在产生鼠标事件时的 y 坐标。Gets the y-coordinate of the mouse during the generating mouse event.

(Inherited from MouseEventArgs)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于