Patagames用键盘滚动PDF

时间:2018-06-06 14:25:58

标签: pdfium

我有点需要帮助。我正在尝试使用键盘在Patagames PDFium .net控件中滚动PDF。不幸的是我无法正确滚动它并且正在寻找一些示例代码(VB或C#)来滚动'line wize(假设每个按键10个像素)和'page wize'。有人可以帮帮我吗? TIA很多。奥莱

1 个答案:

答案 0 :(得分:0)

没关系。找到答案。

   Private Sub PdfViewer1_KeyDown(sender As Object, e As KeyEventArgs) Handles PdfViewer1.KeyDown

      Dim pageStep As Integer = PdfViewer1.AutoScrollMinSize.Height / PdfViewer1.Document.Pages.Count
      Dim lineStep As Integer = pageStep / 30
      Dim asp As Point = PdfViewer1.AutoScrollPosition


      Select Case e.KeyCode
         Case Keys.Up
            PdfViewer1.AutoScrollPosition = New Point(asp.X, -asp.Y - lineStep)
         Case Keys.Down
            PdfViewer1.AutoScrollPosition = New Point(asp.X, -asp.Y + lineStep)
         Case Keys.PageUp
            PdfViewer1.AutoScrollPosition = New Point(asp.X, -asp.Y - pageStep)
         Case Keys.PageDown
            PdfViewer1.AutoScrollPosition = New Point(asp.X, -asp.Y + pageStep)
      End Select

   End Sub