←Select platform

ImageViewerRubberBandInteractiveMode Class


Draws a shape on the viewer.


public class ImageViewerRubberBandInteractiveMode : ImageViewerInteractiveMode 
Public Class ImageViewerRubberBandInteractiveMode 
   Inherits ImageViewerInteractiveMode 
public ref class ImageViewerRubberBandInteractiveMode : ImageViewerInteractiveMode 


The ImageViewerRubberBandInteractiveMode derives from the ImageViewerInteractiveMode and subscribes to the following events of the InteractiveService:

The ImageViewerRubberBandInteractiveMode works as follows:

  1. When DragStarted is received, InteractiveEventArgs.IsHandled is set to true and Render is called to to draw the rubber band shape Shape, BorderPen, and BackgroundBrush are used to customize the appearance of the shape. The RubberBandStarted event is also fired. Note that if you can derive your own class and override Render to customize the rendering of the shape.

  2. When DragDelta is received, InteractiveEventArgs.IsHandled is set to true and Render is called to update the shape. RubberBandDelta is also fired.

  3. When DragCompleted is received, InteractiveEventArgs.IsHandled is set to true and RubberBandCompleted is fired.

The ImageViewerRubberBandInteractiveMode interactive mode does not perform any action on the viewer (besides drawing, moving and then removing the shape). It is up to the user to implement any custom operation required, (for example, to select a region of interest on the image). ImageViewerZoomToInteractiveMode derives from ImageViewerRubberBandInteractiveMode and calls ZoomToRect event. Drawing a rubber-band on the viewer is usually followed by another user operation to perform the action. In most cases, the rubber band is to be restricted on the "work" area. The RestrictToWorkBounds can control this behavior.

For more information, refer to Image Viewer Interactive Modes.


This example will use ImageViewerRubberBandInteractiveMode to select a region of interest in the image. When the user finishes selecting the area, the example will draw a blue with yellow border rectangle on the image.

Start with the ImageViewer example, remove all the code inside the example function (search for the "// TODO: add example code here" comment) and insert the following code:


Target Platforms

Help Version 19.0.2017.10.19
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls.WinForms Assembly