PdfViewerControl.HitTest(Point) Method
In This Article
Gets the visual element located under the point.
Namespace: DevExpress.Xpf.PdfViewer
Assembly: DevExpress.Xpf.PdfViewer.v24.2.dll
NuGet Package: DevExpress.Wpf.PdfViewer
#Declaration
public PdfHitTestResult HitTest(
Point point
)
#Parameters
Name | Type | Description |
---|---|---|
point | Point | A Point structure that specifies the hit point coordinates relative to the control’s top-left corner. |
#Returns
Type | Description |
---|---|
Pdf |
A Pdf |
#Remarks
The HitTest property allows you to identify the type of a visual element located under the test object.
#Example
This example shows how to determine what page was clicked in a document using the PdfViewerControl.HitTest
method of the PdfViewerControl.
using DevExpress.Xpf.PdfViewer;
using System.Windows;
using System.Windows.Input;
namespace DeterminePageNumber {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
pdfViewer.OpenDocument("..\\..\\demo.pdf");
}
private void pdfViewer_MouseDown(object sender, MouseButtonEventArgs e) {
PdfHitTestResult result = pdfViewer.HitTest(e.GetPosition(pdfViewer));
MessageBox.Show(string.Format("You clicked on page {0}", result.DocumentPosition.PageNumber));
}
}
}
See Also