if (!narejeno) printDocument1.PrintPage += new PrintPageEventHandler(natisniDokument_NatisniStran); narejeno = true ; printPreviewDialog1.UseAntiAlias = true ; printPreviewDialog1.ShowDialog(); printPreviewDialog1.MouseWheel += new MouseEventHandler(eventZaPrintPreview_MouseWheel); private void eventZaPrintPreview_MouseWheel( object sender, MouseEventArgs e) if (e.Delta >0) SendKeys.Send( " {UP}" ); SendKeys.Send( " {DOWN}" ); Where to put the event? But it must be in Meni.cs I have done and it is working with the following code (in VB.net)
- you can change it to C# easily
1- First you should to know the number of pages, so count the page number in printpage event (PrintDocument1.PrintPage) (in my code the Variable name is Mpage)
2-Now you can easily change the pages with mouse wheel event as shown below
Private Sub PrintPreviewDialog1_MouseWheel(sender As Object, e As MouseEventArgs) Handles PrintPreviewDialog1.MouseWheel
If e.Delta > 0 And not Thispage = 0 Then
Thispage -= 1
PrintPreviewDialog1.PrintPreviewControl.StartPage = Thispage
ElseIf e.Delta < 0 And not Thispage = Mpage Then
Thispage += 1
PrintPreviewDialog1.PrintPreviewControl.StartPage = Thispage
End If
End Sub
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •