Cursor Modes
- 3 minutes to read
The PDF Viewer has the following cursor modes:
Mode | Example | Description | How to Activate |
---|---|---|---|
Select Tool | Used to select text and images in a document. | Right-click within the document and select Select Tool in the context menu or set the PdfViewer.CursorMode property to SelectTool. | |
Hand Tool | Used for navigation. Move the mouse while pressing the left button to navigate through the document. After you click the document’s page, the mouse pointer changes from to . Drag the mouse pointer to scroll the document. | Right-click within the document and select Hand Tool in the context menu or set the PdfViewer.CursorMode property to HandTool. | |
Marquee Zoom Tool | Used to change the zoom level and view a particular part of the page. Click to increase the zoom level, or click while pressing the Ctrl key to decrease the zoom level. Drag a rectangle around the page portion to zoom in on it. | Right-click within the document and select Marquee Zoom in the context menu or set the PdfViewer.CursorMode property to MarqueeZoom. | |
Text Markup Tools | Used to highlight, underline or strike out text. | Click one of the Text ribbon group buttons on the Comment tab or set the PdfViewer.CursorMode to TextHighlightTool, TextStrikethroughTool, or TextUnderlineTool. | |
Sticky Note tool | Used to create text annotations or sticky notes. | Click Sticky Note on the Comment ribbon tab or set the PdfViewer.CursorMode to StickyNoteTool. |
Create Custom Interaction Tool
Handle mouse and keyboard events to create a custom interaction tool.
The code sample below shows how to handle the MouseMove event to change the appearance of the mouse pointer over different parts of the document’s surface.
public partial class Form1 : RibbonForm
{
Cursor currentCursor = null;
//This property checks whether the cursor is located within the document's borders
bool CursorIsOverPage { get { return pdfViewer.IsDocumentOpened && pdfViewer.GetDocumentPosition(pdfViewer.PointToClient(MousePosition), false) != null; } }
public Form1()
{
InitializeComponent();
pdfViewer.CursorMode = PdfCursorMode.Custom;
pdfViewer.MouseMove += PdfViewer_MouseMove;
currentCursor = pdfViewer.Cursor;
}
private void PdfViewer_MouseMove(object sender, MouseEventArgs e)
{
//Show the No cursor when it hovers over the document
pdfViewer.Cursor = currentCursor != null && CursorIsOverPage ? Cursors.No : currentCursor;
}
}