private void MouseClickHandler(object sender, MouseEventArgs e) { // Do some handling of the event here e.Consume(); // Mark event as handled }
private void MouseWheelHandler(object sender, MouseEventArgs e) { // Do some handling of the event here e.Consume(); // Mark event as handled }This code demonstrates how to consume a mouse wheel event. The event is fired when the user scrolls the mouse wheel up or down, passing the handle to the MouseWheelHandler function. e.Consume() is called to mark the event as handled. In conclusion, the MouseEventArgs Consume method is a useful tool for preventing mouse events from being further propagated. It can be used for different types of mouse events, as shown in the examples above. The package library for this class is System.Windows.Forms.