ScrollTo complimentary function

93 views
Skip to first unread message

Daniel Lutz

unread,
Feb 10, 2014, 6:39:50 AM2/10/14
to pdfne...@googlegroups.com
Hello

i have one question about the function of scrolling to every point of the document. I found this thread ScrollTo Function and try to build an complimentary function for the wpf viewer.

_viewer.ConvPagePtToScreenPt(ref x, ref y,page_numb);
_viewer.SetHScrollPos(x);
_viewer.SetVScrollPos(y);
            

The problem is that the viewer is not scrolling to the right position so what is the mistake in my reflection?

Thanks
Daniel

Tomas Hofmann

unread,
Feb 11, 2014, 7:43:54 PM2/11/14
to pdfne...@googlegroups.com
Hi Daniel,

I'm assuming you got the x and y positions from some object on page number page_num.
The first thing to look at is the scroll position. x and y after converting is in screen space, while SetX/YScrollPos is in the coordinates of the scroll viewer. That is, the top left corner of the PDFViewCtrl is at position (0, 0) in screen space, but at position (GetHScrollPos and GetVScrollPos) in scroll coordinates. I would suggest trying

_viewer.SetHScrollPois(x + _view.GetHScrollPos());
_viewer.SetVScrollPois(y + _view.GetVScrollPos());

If that does not work, could you elaborate a little more on what you are doing?

Best Regards,
Tomas Hofmann

Daniel Lutz

unread,
Feb 12, 2014, 2:24:32 AM2/12/14
to pdfne...@googlegroups.com
Hello Thomas,

thank you for your reply. You answer is so easy and works fine. Now i can jump to every point on every side. Thank you very much.

Best regards
Daniel
Reply all
Reply to author
Forward
0 new messages