MouseEventArgs Class

Contains the arguments returned by a raw mouse event.

Syntax

public ref class MouseEventArgs sealed : IMouseEventArgs 

Remarks

This object is returned by a delegate that is registered for one of the following events:

Note This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX).

Example

// returning keypress events data through MouseEventArgs

void MyMouseEvents::SetWindow( // implementation called by CoreApplication::Run(), provided for context
    _In_ CoreWindow^ window
    )
{
    // ...
    MouseDevice::GetForCurrentView()->MouseMoved +=
        ref new TypedEventHandler<MouseDevice^, MouseEventArgs^>(this, &MyMouseEvents::OnMouseMoved);

    MouseDevice::GetForCurrentView()->MouseWheelMoved +=
        ref new TypedEventHandler<MouseDevice^, MouseEventArgs^>(this, &MyMouseEvents::OnMouseWheelMoved);


    // ...
   
}  

void MyMouseEvents::OnMouseMoved(MouseDevice^ device, MouseEventArgs^ args)
{
    // ...
    
    auto delta = args->MouseDelta;
    // Process movement deltas
}

void MyMouseEvents::OnMouseWheelMoved(MouseDevice^ device, MouseEventArgs^ args)
{
    // ...
    
    auto delta = args->MouseWheelDelta;
    // Process wheel deltas
}
 

Requirements

Namespace: Windows.Devices.Input

Metadata: windows.winmd

See also

Reference

MouseEventArgs Members

Windows.Devices.Input Namespace