The PDF Viewer can draw graphics in the PDF document in the Control.Paint event handler.
In this example, the filled rectangle is drawn at any document space when you hold down the left mouse button and move it.
The PDF Viewer gets the mouse position relative to the PDF Viewer by calling the PdfViewer.GetDocumentPosition method in the MouseDown (when the left mouse is pressed), and MouseMove event handlers (when the mouse is moving).
To draw a filled rectangle in the PDF document, the RectangleF.FromLTRB method is called in the Paint event handler. The start and end client points are obtained using the document position in the PdfViewer.GetClientPoint method.
This example also shows how to draw a rectangle using the Graphics.FillRectangle method.
In this example, the filled rectangle is drawn at any document space when you hold down the left mouse button and move it.
The PDF Viewer gets the mouse position relative to the PDF Viewer by calling the PdfViewer.GetDocumentPosition method in the MouseDown (when the left mouse is pressed), and MouseMove event handlers (when the mouse is moving).
To draw a filled rectangle in the PDF document, the RectangleF.FromLTRB method is called in the Paint event handler. The start and end client points are obtained using the document position in the PdfViewer.GetClientPoint method.
This example also shows how to draw a rectangle using the Graphics.FillRectangle method.