←Select platform

ImageViewerActiveItemInteractiveMode Class

Summary

Allows you to change the current active item in the viewer using the keyboard or mouse/touch.

Syntax
C#
VB
C++
public class ImageViewerActiveItemInteractiveMode : ImageViewerInteractiveMode 
Public Class ImageViewerActiveItemInteractiveMode 
   Inherits ImageViewerInteractiveMode 
public ref class ImageViewerActiveItemInteractiveMode : ImageViewerInteractiveMode 
Remarks

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

ImageViewerActiveItemInteractiveMode changes the current ActiveItem as follows:

  • If the user clicks on an item, it will become the new ActiveItem.

  • If IsKeyboardEnabled is set to true, moving using the arrow, page up/down, home and end key will also set the ActiveItem. This works as a "grid" using the current ViewLayout. For example, if you press the down arrow, the item below the current active item (if any) will become the new active item. If you press the left arrow, the item to the left of the current item will become the new active item, and so on.

  • If the value of IsHoverEnabled is set to true, then moving the mouse over an item will change its IsHovered to true, whereas moving the mouse away from the item sets it back to false. If you changed the image viewer appearance to have different styles for hovered items, then the UI will provide an indication of this operation. For more information, refer to Image Viewer Appearance.

When a new active item is set, InteractiveEventArgs.IsHandled is set to true.

For more information, refer to Image Viewer Interactive Modes.

Example
C#
VB
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
public void ImageViewerActiveItemInteractiveModeExample() 
{ 
   _imageViewer.InteractiveModes.BeginUpdate(); 
   _imageViewer.InteractiveModes.Add(new MyImageViewerInteractivMode { IsHoverEnabled = true, IsKeyboardEnabled = true }); 
   _imageViewer.InteractiveModes.EndUpdate(); 
} 
Imports Leadtools 
Imports Leadtools.Controls 
Imports Leadtools.Codecs 
Imports Leadtools.Drawing 
Imports Leadtools.ImageProcessing 
Imports Leadtools.ImageProcessing.Color 
 
Public Sub ImageViewerActiveItemInteractiveModeExample() 
   _imageViewer.InteractiveModes.BeginUpdate() 
   Dim mode As New MyImageViewerInteractivMode 
   mode.IsHoverEnabled = True 
   mode.IsKeyboardEnabled = True 
   _imageViewer.InteractiveModes.Add(mode) 
   _imageViewer.InteractiveModes.EndUpdate() 
End Sub 
 
Public Class MyImageViewerInteractivMode : Inherits ImageViewerActiveItemInteractiveMode 
   Public Sub New() 
   End Sub 
 
   Public Overrides ReadOnly Property Name() As String 
      Get 
         Return "MyImageViewerInteractivMode" 
      End Get 
   End Property 
 
   Public Overrides ReadOnly Property Id() As Integer 
      Get 
         Return ImageViewerInteractiveMode.UserModeId 
      End Get 
   End Property 
 
   Public Overrides Sub Start(ByVal imageViewer As ImageViewer) 
      MyBase.Start(imageViewer) 
      Dim service As InteractiveService = MyBase.InteractiveService 
      AddHandler service.Tap, AddressOf service_Tap 
   End Sub 
 
   Public Overrides Sub [Stop](ByVal imageViewer As ImageViewer) 
      If IsStarted Then 
         Dim service As InteractiveService = MyBase.InteractiveService 
         RemoveHandler service.Tap, AddressOf service_Tap 
         MyBase.Stop(imageViewer) 
      End If 
   End Sub 
 
   Private Sub service_Tap(ByVal sender As Object, ByVal e As InteractiveEventArgs) 
      If CanStartWork(e) Then 
         e.IsHandled = True 
         OnWorkStarted(EventArgs.Empty) 
 
         Dim imageViewer As ImageViewer = Me.ImageViewer 
 
         imageViewer.BeginRender() 
         ' ... 
         ' ... 
         ' ... 
         ' set your render code here 
         ' ... 
         ' ... 
         ' ... 
         imageViewer.EndRender() 
 
         OnWorkCompleted(EventArgs.Empty) 
      End If 
   End Sub 
End Class 
Requirements
Target Platforms
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.