1

Using PDFViewer1 how would one implement their own zoom-in and zoom-out controls?

I have Zoom-In and Zoom-Out picturebox graphics on my form, that when clicked I want to either zoom in or zoom out respectively.

I program in VB.net using Visual Studio 2012

In my feeble attempt this is what I have:

Private Sub Zoom_In_Click(sender As Object, e As EventArgs) Handles Zoom_In.Click
    Me.PdfViewer1.ZoomMode = PdfZoomMode.Custom
    Me.PdfViewer1.ZoomFactor = 120
    Me.PdfViewer1.Refresh()
End Sub

I would appreciate anyone pointing me in the right direction using either VB or C#, thanks for your help.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • 1
    DevExpress has one of the best support people/policy I ever came across. I cannot imagine a single case where I got no answer. So why ask here on SO when you can get the real thing directly from DevExpress? – Uwe Keim Feb 15 '14 at 22:44
  • 1
    Appreciate your response Uwe. I have posted the question on DevExpress forums yesterday and have had no response as of yet. I need an answer as soon as possible. Knowing that the StackOverflow community is quite large I posted here as well, hoping for an answer sooner than later. – user3314620 Feb 15 '14 at 22:50

1 Answers1

1

You can use the PdfZoomInCommand/PdfZoomOUtCommand commands:

PdfViewerCommand zoomIn;
PdfViewerCommand zoomOut;
//...
    zoomIn = new PdfZoomInCommand(pdfViewer1);
    zoomOut = new PdfZoomOutCommand(pdfViewer1);
//...
void buttonZoomIn_Click(object sender, EventArgs e) {
    if(zoomIn.CanExecute())
        zoomIn.Execute();
}
void buttonZoomOut_Click(object sender, EventArgs e) {
    if(zoomOut.CanExecute())
        zoomOut.Execute();
}
DmitryG
  • 17,677
  • 1
  • 30
  • 53