Scrolling speed of WPF viewer cOntrol

已查看 287 次
跳至第一个未读帖子

Daniel Lutz

未读,
2018年5月18日 12:51:462018/5/18
收件人 PDFTron PDFNet SDK
Hey,

i use the pdfnet .net 4.0 sdk in specially the wpf control. Is there a way to set up the scolling speed up of the control when the person use the mouswheel to scroll in the document.

Best regards

Daniel

Ryan

未读,
2018年5月23日 12:55:572018/5/23
收件人 PDFTron PDFNet SDK
PDFViewWPF is using a Windows WPF ScrollViewer, so to add your own custom scrolling logic, to take into account the Control Panel's Vertical Scrolling setting in the Mouse Properties window,  you need to do the following.

1. Hide the built in scroll bars
2. Add your own scroll bars and connect to PDFViewWPF.
3. Query the System.Windows.Forms.SystemInformation.MouseWheelScrollLines to get the users current setting.
4. Calculate new value to scroll by.

The following information will help you get started accomplishing the above.

The PDFViewWPF class has properties for HorizontalScrollBarVisibility and VerticalScrollBarVisibility.
Setting both of them to hidden will let you attach your own Scroller that is external. You can then make this touch enabled if you wish.

To help you with this, I have modifed PDFViewControl.xaml and PDFViewControl.xaml.cs so that a separate Scroller is used that syncs with the PDFViewWPF. I made it reddish in color, to make it more visible. I call it MyScrollBarOnTheSide. See attached.

The interesting parts of PDFViewControl.xaml.cs are at the bottom of the constructor, where I hide the PDFViewWPF's vertical scrollbar, and register for the ValueChanged event of MyScrollBarOnTheSide. I then modified some of the event handlers for the PDFViewWPF, which you can find by searching for SyncScrollBarPosition and SyncScrollerFromViewer. Finally, there's a region labelled ScrollbarSyncing at the bottom of the file.

This should give you a good framework to replace the scroller, which will let you add in your custom handling of the MouseWheelScrollLines user setting.
PDFViewControl.xaml.cs.txt
PDFViewControl.xaml.txt
回复全部
回复作者
转发
0 个新帖子