Override MouseWheel event

UI
8/21/2015

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.

1 public class MyPagesViewer : TallComponents.Interaction.WinForms.Controls.StandardPagesViewer 2 { 3 protected override void OnMouseWheel(MouseEventArgs e) 4 { 5 // custom action such as zooming here 6 7 ((HandledMouseEventArgs)e).Handled = true; 8 } 9 }

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

1 public class MainForm : System.Windows.Forms.Form 2 { 3 #region Windows Form Designer generated code 4 5 private void InitializeComponent() 6 { 7 ... 8 this.pagesViewer = new TallComponents.PDF.ReaderControls.MyPagesViewer(); 9 ... 10 } 11 }