Mouse scroll supoort in the form

Mouse scroll supoort in the form

Post by avant » Sun, 01 Oct 2006 03:23:40


Hi,
I have an application that can be installed from the intranet link
inside the company. I have added support for the mouse wheel scrolling
on the forms. However, it workd from only some machines and not all.

Here is the code:


/// <summary>
/// Enable the mouse wheel scrolling
/// </summary>
/// <param name="sender">Caller object</param>
/// <param name="e">Argumnets to the event</param>
private void WheelEvent(object sender, MouseEventArgs e)
{
int numberOfTextLinesToMove = e.Delta *
SystemInformation.MouseWheelScrollLines / 120;
int numberOfPixelsToMove = numberOfTextLinesToMove * 10;

if (numberOfPixelsToMove != 0)
{
if (numberOfPixelsToMove <= 0)
StepContainerFlowLayoutPanel.VerticalScroll.Value
+= Math.Abs(numberOfPixelsToMove);
else
if
(StepContainerFlowLayoutPanel.VerticalScroll.Value >
numberOfPixelsToMove)

StepContainerFlowLayoutPanel.VerticalScroll.Value -=
numberOfPixelsToMove;
else

StepContainerFlowLayoutPanel.VerticalScroll.Value = 0;
}
}

Do I need to do some extra work to support different kinds of mouse?

Thanks,
Avanti