Scrolling Contents Of C1OutPage Using MouseWheel

The C1OutBar supports scrolling through scrollbars as shown in the image below : In this blog we will implement scrolling through MouseWheel event inside C1OutPage when it contains lot of child controls. This behavior can be overridden using custom code to handle the 'MouseWheel' event of C1OutBar. Lets quickly go through step by step implementation of the code.

Add Event Handlers

The first step is to subscribe the MouseWheel event of the C1OutBar. This is done in the form constructor using the following code :

public Form1()  
      c1OutBar1.MouseWheel += new MouseEventHandler(c1OutBar1_MouseWheel);  
      c1CommandHolder1.CommandClick += new C1.Win.C1Command.CommandClickEventHandler(c1CommandHolder1_CommandClick);  


Set Focus On C1OutBar

For our implementation we need to put in focus to C1OutBar in order to receive MouseWheel messages.

void c1CommandHolder1_CommandClick(object sender, C1.Win.C1Command.CommandClickEventArgs e)  

Modify MouseWheel Event

In the MouseWheel Event we can check the value of e.Delta . If it's negative then we can call the ScrollDown() method of C1OutBar to move down or vice versa.

void c1OutBar1_MouseWheel(object sender, MouseEventArgs e)  
       if (e.Delta < 0)  

Download sample for complete implementation Download sample


GrapeCity Developer Tools
comments powered by Disqus