PdfViewer.PdfViewerMouseClick Event
Occurs when user clicks on a PdfViewer control.
public event PdfViewerMouseEventHandler PdfViewer.PdfViewerMouseClick;
Public Event PdfViewer.PdfViewerMouseClick As PdfViewerMouseEventHandler
Event Handler
Licensing Info
This event is a DynamicPDF Viewer feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Viewer selected.
- A DynamicPDF Viewer for .NET v3.X Developer license.
Examples
This example demonstrates, how to get the click event with information about the page co-ordinates using PdfViewerMouseEventArgs class.Imports System
Imports System.Windows.Forms
Imports ceTe.DynamicPDF.Viewer
Imports System.Drawing
Public Class Form1
Inherits System.Windows.Forms.Form
Private MyPdfViewer As PdfViewer
Sub New()
InitializeComponent()
End Sub
Shared Sub Main()
Application.Run(New Form1())
End Sub
Private Sub InitializeComponent()
Me.MyPdfViewer = New PdfViewer()
Me.Controls.Add(MyPdfViewer)
AddHandler MyPdfViewer.PdfViewerMouseClick, AddressOf MyPdfViewer_MouseClicked
End Sub
Private Sub MyPdfViewer_MouseClicked(ByVal sender As Object, ByVal e As ceTe.DynamicPDF.Viewer.PdfViewerMouseEventArgs)
' Get the co-ordinates on the control.
Dim ControlCoordinate As Point = e.Location
' Get the page number.
Dim PageNumber As Integer = e.PageNumber
' Get the co-ordinates on the page (in PDF points).
Dim PageCoordinateX As Integer = e.PageX
Dim PageCoordinateY As Integer = e.PageY
End Sub
End Class
using System;
using System.Windows.Forms;
using ceTe.DynamicPDF.Viewer;
using System.Drawing;
namespace DynamicPDFViewerDemo
{
public class Form1 : Form
{
private PdfViewer dpdfViewer;
public Form1()
{
InitializeComponent();
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void InitializeComponent()
{
this.dpdfViewer = new PdfViewer();
this.Controls.Add(dpdfViewer);
PdfViewerMouseClick += new ceTe.DynamicPDF.Viewer.PdfViewerMouseEventHandler(this.pdfViewer_MouseClicked);
}
private void pdfViewer_MouseClicked(object sender, ceTe.DynamicPDF.Viewer.PdfViewerMouseEventArgs e)
{
// Get the co-ordinates on the control.
Point controlCoordinate = e.Location;
// Get the page number.
int pageNumber = e.PageNumber;
// Get the co-ordinates on the page (in PDF points).
int pageCoordinateX = e.PageX;
int pageCoordinateY = e.PageY;
}
}
}
Remarks
By default this event fires only for left mouse click. For handling right mouse click ContextMenuShowing event can be used. If context menu displaying is disabled using ContextMenuShowing event, then both left and right mouse clicks will fire this event.