Override MouseWheel event

This code sample helps to override MouseWheel event. The default behavior of the the mouse wheel is to scroll. To override this default behavior, you must introduce a new class that inherits from StandardPagesViewer and override the OnMouseWheel method like this: following code shows how to override this default our.

public class MyPagesViewer : TallComponents.Interaction.WinForms.Controls.StandardPagesViewer
{
  protected override void OnMouseWheel(MouseEventArgs e)
  {
    // custom action such as zooming here

    ((HandledMouseEventArgs)e).Handled = true;
  }
}

Inside the InitializeComponent of your MainForm, make sure that you instantiate this new class like this:

public class MainForm : System.Windows.Forms.Form
{
  #region Windows Form Designer generated code

  private void InitializeComponent()
  {
    ...
    this.pagesViewer = new TallComponents.PDF.ReaderControls.MyPagesViewer();
    ...
  }
}
Download PDFControls.NET 3.0
We will send you a download link
Why do we ask your email address?
We send tips that speed up your evaluation
We let you know about bug fixes
You can always unsubscribe with one click
We never share your address with a 3rd party
Thank you for your download

We have sent an email with a download link.