user3314620
user3314620

Reputation: 11

Devexpress winform PDFViewer Zoom In and Zoom Out

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.

Upvotes: 1

Views: 1678

Answers (1)

DmitryG
DmitryG

Reputation: 17850

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();
}

Upvotes: 1

Related Questions