Represents the base class for the rich user experience features of an ImageViewer
public abstract class ImageViewerInteractiveModePublic MustInherit Class ImageViewerInteractiveModepublic sealed class ImageViewerInteractiveModeiOS:@interface LTImageViewerInteractiveMode : NSObject <LTInteractiveServiceDelegate, LTInteractiveServiceBasicDelegate, UIGestureRecognizerDelegate, NSCoding>macOS:@interface LTImageViewerInteractiveMode : NSObject <LTInteractiveServiceMouseDelegate, NSCoding>
public abstract class ImageViewerInteractiveModefunction Leadtools.Controls.ImageViewerInteractiveMode()ImageViewerInteractiveMode works with the InteractiveService object of the ImageViewer to provide rich user interface experience when the user interacts with the viewer using mouse or touch.
ImageViewerInteractiveMode is a base abstract class, you can derive your own class to handle custom interaction with the viewer. Out of the box, LEADTOOLS provide the following implementations:
| Class | Description |
|---|---|
| ImageViewerPanZoomInteractiveMode |
Supports panning and zooming with the mouse and multi-touch. |
| ImageViewerZoomToInteractiveMode |
Zooms to image rectangle created by the user using mouse or touch. |
| ImageViewerMagnifyGlassInteractiveMode |
Magnifies the portion of the image under the mouse or touch. |
| ImageViewerCenterAtInteractiveMode |
Centers the image inside the user based on user mouse click or touch tap. |
| ImageViewerRubberBandInteractiveMode |
Draws a temporary rectangle on top of the image using the mouse or touch. Can be used to perform any extra functionality such as drawing a region of interest for a user-defined operation. |
To use an interactive mode, you create an instance of any of the derived classes and assign it to the viewer using one of the following methods:
ImageViewer.DefaultInteractiveMode: Assigns the interactive mode to be set as the default one.
ImageViewer.TouchInteractiveMode: Assigns the interactive mode in devices that support touch.
ImageViewer.MouseWheelInteractiveMode: Assigns the interactive mode to the mouse wheel.
using Leadtools;using Leadtools.Codecs;using Leadtools.Controls;// RotateInteractiveMode[TestClass]public class ImageViewerRotateInteractiveMode : ImageViewerInteractiveMode{public ImageViewerRotateInteractiveMode(){}public override string Name{get { return "Rotate"; }}public override string ToString(){return Name;}// Called by the base class when the mode is startedpublic override void Start(ImageViewer viewer){base.Start(viewer);// add EventHandlers to the DragStarted, DragDelta and DragCompleted eventsbase.InteractiveService.DragStarted += InteractiveService_DragStarted;base.InteractiveService.DragDelta += InteractiveService_DragDelta;base.InteractiveService.DragCompleted += InteractiveService_DragCompleted;}// Called by the base class when the mode is stoppedpublic override void Stop(ImageViewer viewer){// Check if we have startedif (IsStarted){// remove EventHandlers from eventsbase.InteractiveService.DragStarted -= InteractiveService_DragStarted;base.InteractiveService.DragDelta -= InteractiveService_DragDelta;base.InteractiveService.DragCompleted -= InteractiveService_DragCompleted;// Always call base class stop methodbase.Stop(viewer);}}// Called when the user starts a drag operationvoid InteractiveService_DragStarted(object sender, InteractiveDragStartedEventArgs e){if (!this.CanStartWork(e)){return;}// Inform whoever is listening that we have started workingthis.OnWorkStarted(EventArgs.Empty);}// Called when the user is draggingvoid InteractiveService_DragDelta(object sender, InteractiveDragDeltaEventArgs e){// If we are not working (for example, the user has not clicked the mouse button yet), then// nothing to doif (!this.IsWorking){return;}// Perform our operation, get the change of the drag, then increase// or decrease the current rotation angle based on directionvar viewer = this.ImageViewerControl;var change = e.Change;var delta = 4;if (change.X < 0){viewer.RotateAngle = viewer.RotateAngle - delta;}else if (change.X > 0){viewer.RotateAngle = viewer.RotateAngle + delta;}}// Called when the user has stopped draggingvoid InteractiveService_DragCompleted(object sender, InteractiveDragCompletedEventArgs e){if (!this.IsWorking){return;}// Inform whoever is listening that we have stoped workingthis.OnWorkCompleted(EventArgs.Empty);}}//set InteractiveMode in new ImageViewerImageViewer InteractiveModeExample(){Uri imageUrl = new Uri("ms-appx:///Assets/PngImage2.png");// Create the viewervar viewer = new Leadtools.Controls.ImageViewer();// Set the image Sourceviewer.Source = new BitmapImage(imageUrl);// Set Rotate as our interactive modeviewer.DefaultInteractiveMode = new ImageViewerRotateInteractiveMode();return viewer;}
|
Products |
Support |
Feedback: ImageViewerInteractiveMode Class - OLeadtools.Controls |
Introduction |
Help Version 19.0.2017.3.23
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.