←Select platform

ImageViewerActiveItemInteractiveMode Class


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

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

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.

using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
public void ImageViewerActiveItemInteractiveModeExample() 
   _imageViewer.InteractiveModes.Add(new MyImageViewerInteractivMode { IsHoverEnabled = true, IsKeyboardEnabled = true }); 
Imports Leadtools 
Imports Leadtools.Controls 
Imports Leadtools.Codecs 
Imports Leadtools.Drawing 
Imports Leadtools.ImageProcessing 
Imports Leadtools.ImageProcessing.Color 
Public Sub ImageViewerActiveItemInteractiveModeExample() 
   Dim mode As New MyImageViewerInteractivMode 
   mode.IsHoverEnabled = True 
   mode.IsKeyboardEnabled = True 
End Sub 
Public Class MyImageViewerInteractivMode : Inherits ImageViewerActiveItemInteractiveMode 
   Public Sub New() 
   End Sub 
   Public Overrides ReadOnly Property Name() As String 
         Return "MyImageViewerInteractivMode" 
      End Get 
   End Property 
   Public Overrides ReadOnly Property Id() As Integer 
         Return ImageViewerInteractiveMode.UserModeId 
      End Get 
   End Property 
   Public Overrides Sub Start(ByVal imageViewer As 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 
      End If 
   End Sub 
   Private Sub service_Tap(ByVal sender As Object, ByVal e As InteractiveEventArgs) 
      If CanStartWork(e) Then 
         e.IsHandled = True 
         Dim imageViewer As ImageViewer = Me.ImageViewer 
         ' ... 
         ' ... 
         ' ... 
         ' set your render code here 
         ' ... 
         ' ... 
         ' ... 
      End If 
   End Sub 
End Class 
Target Platforms
Help Version 21.0.2021.3.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly