logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
Miralon Posted: Wednesday, October 4, 2017 5:06:04 AM(UTC)
 
Great! Thanks.

Michal
Paul Rayman Posted: Wednesday, October 4, 2017 4:50:57 AM(UTC)
 
Code:

...
pdfViewer1.KeyDown += PdfViewer1_KeyDown;
...

private void PdfViewer1_KeyDown(object sender, KeyEventArgs e)
{
	int pageStep = pdfViewer1.AutoScrollMinSize.Height / pdfViewer1.Document.Pages.Count;
	int lineStep = pageStep / 30;
	var asp = pdfViewer1.AutoScrollPosition;

	switch (e.KeyCode)
	{
		case Keys.Down:
			pdfViewer1.AutoScrollPosition = new Point(asp.X, -asp.Y + lineStep);
			break;
		case Keys.Up:
			pdfViewer1.AutoScrollPosition = new Point(asp.X, -asp.Y - lineStep);
			break;
		case Keys.PageDown:
			pdfViewer1.AutoScrollPosition = new Point(asp.X, -asp.Y + pageStep);
			break;
		case Keys.PageUp:
			pdfViewer1.AutoScrollPosition = new Point(asp.X, -asp.Y - pageStep);
			break;
	}
}

Miralon Posted: Wednesday, October 4, 2017 4:25:09 AM(UTC)
 
WinForms.

Michal
Paul Rayman Posted: Wednesday, October 4, 2017 3:25:51 AM(UTC)
 
Winfroms or WPF?
Miralon Posted: Wednesday, October 4, 2017 1:07:28 AM(UTC)
 
Is it possible to scroll document shown id pdfViewer control using arrow keys (up, down)? It can be done using mouse wheel, but how to achieve this using keyboard arrows keys?

Michal