We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How can I handle the Wheel Mouse control in TreeViewAdv control (windows Froms)

Hello,

We are using Syncfusion TreeViewAdv control (windows form) to create an add in to excel. When focus is on a vertical scrolling control inside the Excel task pane and the user moves the mouse scroll wheel both take the scroll (the control and the associated worksheet) How we can handle the wheel event this issue only happen in Syncfusion control not in the Microsoft TreeView.

thank you

1 Reply

ST Saravanan T Syncfusion Team June 3, 2015 07:07 AM UTC

Hi Yosvany,

Sorry for the inconvenience caused,

In this reported scenario, TreeViewAdv captures the MouseWheel input of its Parent container and hence TreeViewAdv scrolling functionality is also invoked. This reported requirement can be achieved by creating custom control which is inherited from TreeViewAdv and overriding its function “OnMouseWheel”. Please make use of below code snippet.

Code Snippet: [C#]

protected override void OnMouseWheel(System.Windows.Forms.MouseEventArgs e)

{

    HandledMouseEventArgs handledEventArgs = e as HandledMouseEventArgs;

    if (handledEventArgs == null || !handledEventArgs.Handled)

    {

        if (((Control.ModifierKeys & (Keys.Alt | Keys.Shift)) == Keys.None) && (Control.MouseButtons == MouseButtons.None))

        {

            if (handledEventArgs != null)

            {

                handledEventArgs.Handled = true;

            }

        }

    }

    base.OnMouseWheel(e);
}


We have also prepared a sample, MSDN Link and reordered a video for your reference and it can be downloaded from the following location.

Sample Location: http://www.syncfusion.com/downloads/support/forum/119283/ze/TreeViewAdv_ExcelAddin-135493008

Video Location: http://www.syncfusion.com/downloads/support/forum/119283/ze/TreeView_TestingVideo-519683845

MSDN Link : https://msdn.microsoft.com/en-us/library/system.windows.forms.handledmouseeventargs(v=vs.110).aspx

We have considered this requirement as bug and this fix will be included in our main release Volume 2, 2015, which will be released in June 2015. Could you please check with the above sample and video and let us know if it helps? Otherwise please share us more details about the reported scenario. That will be helpful for us to analyze and provide you a prompt solution as earlier as possible.

Please let us know if you need any further assistance on this,

Regards,
Saravanan T

Loader.
Up arrow icon