The following sample code demonstrates scrolling the displayed image with the mouse wheel using the BiDisp control.
To scroll the image using the mouse wheel, the MouseWheel event or the WM_MOUSEWHEEL window message must be handled in the parent window of the BiDisp control.
For C# using the BiDisp.ocx, please see the following sample code:
private void MyWindow_Load(object sender, System.EventArgs e)
{
MouseWheel += MyWindow_MouseWheel;
}
private void MyWindow_MouseWheel(object sender, MouseEventArgse)
{
BiDisp.SetVerticalScrollPos(BiDisp.GetVerticalScrollPos() - e.Delta);
}
In C++, using the BiDisp.DLL:
BOOL CMyWindow::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
POINT ptNew;
// dsDisplayStruct is the DISPLAYSTRUCT structure of BiDisp
ptNew = dsDisplayStruct.pScrollPos;
ptNew.y -= zDelta;
DisplaySetScrollPos(GetSafeHwnd(), &dsDisplayStruct, &ptNew);
}