I am programming a WinForms Application that creates a report. When the report is created we have two options: One option we have is Preview and the other option is Print.
When we choose vista previa
we get the report, which we get with the full width of the page, we hit it with the mouse wheel to see the other pages and they load fine, but when we change the option in the upper panel to Toda la página
, where all the pages are seen of the report when clicking the mouse wheel we go from page 1 to 3 without going through page 2 and then if we get to page 4 and click it up we go to page 2 without going through page 3.
Here are some screenshots:
- Start of the application
- Two options
- 1st page of 4 total
Third page of 4
Thanks to the contribution of Mauricio Arias Olave I found the solution. I reinvented the code to pass it to C# and since it only failed me when I moved the mouse wheel and the whole page was with the report, I just used what really worked for me. Here I leave the code made in C # to serve for more people who encounter this problem:
The first thing I did was implement in the form where I have the reportviewer, inside the form's constructor, we put an instruction to initialize the event when we move the mouse wheel:
We add a list called scrolled that we will then use at the beginning of the class:
And we add the method, which enters when we are in the reportviewer and we click the mouse wheel:
With this we fix the problem that when we hit the mouse wheel, the reportviewer jumps two pages at a time, instead of one at a time.