How to Control in. Net without responding to the scroll wheel action

Source: Internet
Author: User

In the VB6.0 era, VB does not support mouse scroll wheel embedded yet. You need to use APIs to send the wm_mousewheel message of the mouse to the control to respond to rolling events. This is usually troublesome, andCodeIt is not easy to control.

Today, I studied in. NET and found that the. Net Control itself supports the mousewheel event. However, there is another problem. Since the mouse scroll wheel event can be responded by default, it is troublesome if I want to disable it, that is, the control does not respond to the scroll wheel. The difference is msdn. In fact, Microsoft has designed a class of handledmouseeventargs, which is defined as follows:


Public class handledmouseeventargs

Inherits system. Windows. Forms. mouseeventargs

Member: system. Windows. Forms


Allow custom controls to prevent system. Windows. Forms. Control. mousewheel events from being sent to its parent container.

This class inherits from mouseeventargs, that is, I can assign the parameter E of the mouse event response to it, and then there is an object of this class to disable the event handle. The sample code is as follows:


Private sub form=mousewheel (_

Byval sender as object ,_

Byval e as system. Windows. Forms. mouseeventargs )_

Handles me. mousewheel

Dim WM as handledmouseeventargs = E

WM. Handled = true

End sub


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.