←Select platform

ScrollChanged Event

Summary

Occurs when changes are detected to the scrollbars position, extent, viewport size or visibility of the control.

Syntax

C#
VB
C++
public event EventHandler<ImageViewerScrollChangedEventArgs> ScrollChanged 
  
Public Event ScrollChanged As EventHandler(Of ImageViewerScrollChangedEventArgs) 
public: 
event EventHandler<ImageViewerScrollChangedEventArgs^>^ ScrollChanged 

Event Data

The event handler receives an argument of type ImageViewerScrollChangedEventArgs containing data related to this event. The following ImageViewerScrollChangedEventArgs properties provide information specific to this event.

PropertyDescription
Handled (Inherited from System.Windows.RoutedEventArgs)
HorizontalChange Gets a value that indicates the change in horizontal offset for a ImageViewer or RasterImageViewer.
HorizontalOffset Gets the updated horizontal offset value for a ImageViewer or RasterImageViewer.
OriginalSource (Inherited from System.Windows.RoutedEventArgs)
RoutedEvent (Inherited from System.Windows.RoutedEventArgs)
Source (Inherited from System.Windows.RoutedEventArgs)
VerticalChange Gets a value that indicates the change in vertical offset for a ImageViewer or RasterImageViewer.
VerticalOffset Gets the updated vertical offset value for a ImageViewer or RasterImageViewer.
Remarks

This event is raised if any action through user interaction or programmatically that cause the scrollbars position, extent, view port size or visibility of the control.

Example

C#
VB
Silverlight C#
Silverlight VB
using Leadtools.Help; 
using Leadtools.Windows.Controls; 
 
public void ImageViewer_ScrollChanged(ImageViewer viewer) 
{ 
   if (viewer.Source != null) 
   { 
      // Scroll to the image center 
      viewer.ScrollChanged += new EventHandler<ImageViewerScrollChangedEventArgs>(viewer_ScrollChanged); 
      viewer.ScrollViewer.ScrollToHorizontalOffset(viewer.Source.Width / 2); 
      viewer.ScrollViewer.ScrollToVerticalOffset(viewer.Source.Height / 2); 
 
      viewer.ScrollChanged -= new EventHandler<ImageViewerScrollChangedEventArgs>(viewer_ScrollChanged); 
   } 
} 
 
void viewer_ScrollChanged(object sender, ImageViewerScrollChangedEventArgs e) 
{ 
   string s = string.Format("HorizontalOffset : {0}, VerticalOffset : {1}", e.HorizontalOffset, e.VerticalOffset); 
   MessageBox.Show(s); 
} 
Imports Leadtools.Windows.Controls 
 
Public Sub ImageViewer_ScrollChanged(ByVal viewer As ImageViewer) 
   If Not viewer.Source Is Nothing Then 
      ' Scroll to the image center 
      AddHandler viewer.ScrollChanged, AddressOf viewer_ScrollChanged 
      viewer.ScrollViewer.ScrollToHorizontalOffset(viewer.Source.Width / 2) 
      viewer.ScrollViewer.ScrollToVerticalOffset(viewer.Source.Height / 2) 
 
      RemoveHandler viewer.ScrollChanged, AddressOf viewer_ScrollChanged 
   End If 
End Sub 
 
Private Sub viewer_ScrollChanged(ByVal sender As Object, ByVal e As ImageViewerScrollChangedEventArgs) 
   Dim s As String = String.Format("HorizontalOffset : {0}, VerticalOffset : {1}", e.HorizontalOffset, e.VerticalOffset) 
   MessageBox.Show(s) 
End Sub 
using Leadtools.Help; 
using Leadtools.Windows.Controls; 
 
public void ImageViewer_ScrollChanged(ImageViewer viewer) 
{ 
   if (viewer.Source != null) 
   { 
      // Scroll to the image center 
      viewer.ScrollChanged += new EventHandler<ImageViewerScrollChangedEventArgs>(viewer_ScrollChanged); 
      viewer.ScrollViewer.ScrollToHorizontalOffset(((BitmapSource)viewer.Source).PixelWidth / 2); 
      viewer.ScrollViewer.ScrollToVerticalOffset(((BitmapSource)viewer.Source).PixelHeight / 2); 
 
      viewer.ScrollChanged -= new EventHandler<ImageViewerScrollChangedEventArgs>(viewer_ScrollChanged); 
   } 
} 
 
void viewer_ScrollChanged(object sender, ImageViewerScrollChangedEventArgs e) 
{ 
   string s = string.Format("HorizontalOffset : {0}, VerticalOffset : {1}", e.HorizontalOffset, e.VerticalOffset); 
   MessageBox.Show(s); 
} 
Imports Leadtools 
Imports Leadtools.Windows.Controls 
 
Public Sub ImageViewer_ScrollChanged(ByVal viewer As ImageViewer) 
   If Not viewer.Source Is Nothing Then 
      ' Scroll to the image center 
      AddHandler viewer.ScrollChanged, AddressOf viewer_ScrollChanged 
      viewer.ScrollViewer.ScrollToHorizontalOffset((CType(viewer.Source, BitmapSource)).PixelWidth / 2) 
      viewer.ScrollViewer.ScrollToVerticalOffset((CType(viewer.Source, BitmapSource)).PixelHeight / 2) 
 
      RemoveHandler viewer.ScrollChanged, AddressOf viewer_ScrollChanged 
   End If 
End Sub 
 
Private Sub viewer_ScrollChanged(ByVal sender As Object, ByVal e As ImageViewerScrollChangedEventArgs) 
   Dim s As String = String.Format("HorizontalOffset : {0}, VerticalOffset : {1}", e.HorizontalOffset, e.VerticalOffset) 
   MessageBox.Show(s) 
End Sub 

Requirements

Target Platforms

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

Leadtools.Windows.Controls Assembly