I just wanted to document the code for this, so that it's easier for others to find. I had a heck of a time finding code to do this. Finally this thread lead me in the right direction: thread796-1012322
There were however a few typos when the original poster converted from C# to VB. Here's the code I ended up using to get mouse scrolling to work on a Crystal Reports Viewer.
Again, I'd like to make it clear, I'm not trying to take any credit for the idea or fix, I just want to document the working code so that others do not have to spend so much time working on this.
FYI, I'm using Crystal Reports XI R2 Developer edition and VB.NET 2005
There were however a few typos when the original poster converted from C# to VB. Here's the code I ended up using to get mouse scrolling to work on a Crystal Reports Viewer.
Again, I'd like to make it clear, I'm not trying to take any credit for the idea or fix, I just want to document the working code so that others do not have to spend so much time working on this.
FYI, I'm using Crystal Reports XI R2 Developer edition and VB.NET 2005
Code:
Imports CrystalDecisions.Windows.Forms
Private Sub ReportViewer_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles myReportViewer.MouseWheel
Dim ctlPageview As New Control
For Each ctl As Control In myReportViewer.Controls
If (ctl.GetType().Equals(GetType(PageView))) Then
ctlPageview = CType(ctl, PageView)
End If
Next
If Not ctlPageview.Equals(Nothing) Then
Dim ctlDocument As DocumentControl
For Each ctl As Control In ctlPageview.Controls
If (ctl.GetType().Equals(GetType(TabControl))) Then
ctlDocument = CType(CType(ctl, TabControl).SelectedTab, DocumentControl)
End If
Next
If Not ctlDocument.Equals(Nothing) Then
Dim pnt As Point = ctlDocument.AutoScrollPosition
Dim numberOfLinesToMove As Int16 = e.Delta * SystemInformation.MouseWheelScrollLines / 120 'WHEEL_DATA
Dim numberOfPixelsToMove As Integer = numberOfLinesToMove * 10 'font size 10
pnt.Offset(numberOfLinesToMove, numberOfPixelsToMove)
ctlDocument.AutoScrollPosition = pnt
End If
End If
End Sub