Occurs when an operation is invoked inside this document viewer.
public event EventHandler<DocumentViewerOperationEventArgs> Operation
Public Event Operation As EventHandler(Of Leadtools.Document.Viewer.DocumentViewerOperationEventArgs)
public:
event EventHandler<Leadtools::Documents::UI::DocumentViewerOperationEventArgs^>^ Operation
The Operation event occurs anytime the document viewer is performing an operation. Such as when rendering the place holder of a page on the View, when a new annotation object is added, and so forth.
Each Operation event fires twice, first with the value of DocumentViewerOperationEventArgs.IsPostOperation set to false to indicate that the operation is about to happen. Then with DocumentViewerOperationEventArgs.IsPostOperation set to true to indicate that the operation is completed.
The operation type is stored in Operation. When IsPostOperation is false, some operations allow the user to change the behavior or abort the operation.
Refer to Document Viewer Operations for a detailed list of all document viewer operations.
Start with the example created in DocumentViewer, remove all the code in the Example function and add the code below.
When the user clicks the example button, we will intercept when the user clicks on a link in the page and show a message box.
using Leadtools;
using Leadtools.Controls;
using Leadtools.Document;
using Leadtools.Document.Viewer;
using Leadtools.Codecs;
using Leadtools.Caching;
using Leadtools.Annotations.Engine;
using Leadtools.Ocr;
// Disable the example button, this should only run once
exampleButton.Enabled = false;
_documentViewer.Operation += (sender, e) =>
{
if (e.Operation == DocumentViewerOperation.RunLink && !e.IsPostOperation)
{
var link = (DocumentLink)e.Data1;
Console.WriteLine("Linked at specified location clicked and ignored: " + link.Bounds.ToString());
e.Abort = true;
}
};
Imports Leadtools
Imports Leadtools.Controls
Imports Leadtools.Document
Imports Leadtools.Document.Viewer
Imports Leadtools.Codecs
Imports Leadtools.Caching
Imports Leadtools.Annotations.Engine
Imports Leadtools.Ocr
' Disable the example button, this should only run once
exampleButton.Enabled = False
AddHandler _documentViewer.Operation,
Sub(sender, e)
If e.Operation = DocumentViewerOperation.RunLink AndAlso Not e.IsPostOperation Then
Dim link As DocumentLink = CType(e.Data1, DocumentLink)
MessageBox.Show("Linked at specified location clicked and ignored: " + link.Bounds.ToString())
e.Abort = True
End If
End Sub
Parameter | Type | Description |
---|---|---|
sender | object | The source of the event. |
e | DocumentViewerOperationEventArgs | The event data. |
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document