PdfViewer.CursorMode Property

Gets or sets a value that specifies the interaction mode for keyboard and cursor.

Namespace: DevExpress.XtraPdfViewer

Assembly: DevExpress.XtraPdfViewer.v20.1.dll

Declaration

[DefaultValue(PdfCursorMode.SelectTool)]
public PdfCursorMode CursorMode { get; set; }
<DefaultValue(PdfCursorMode.SelectTool)>
Public Property CursorMode As PdfCursorMode

Property Value

Type Default Description
PdfCursorMode

SelectTool

A PdfCursorMode enumeration value.

Remarks

The PDF Viewer does not handle mouse and keyboard events. Set the CursorMode property to Custom and handle these events to create your custom interaction tool.

The code sample below shows how to handle the MouseMove event so that when the cursor hovers over the document's surface, it appears as follows:

IMAGE

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

See Also