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.
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()
{
InitializeComponent();
c1OutBar1.MouseWheel += new MouseEventHandler(c1OutBar1_MouseWheel);
c1CommandHolder1.CommandClick += new C1.Win.C1Command.CommandClickEventHandler(c1CommandHolder1_CommandClick);
}
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)
{
c1OutBar1.Focus();
}
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)
c1OutBar1.ScrollDown(1);
else
c1OutBar1.ScrollUp(1);
}
Download sample for complete implementation Download sample