LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly)

ScrollChanged Event

Show in webframe
Example 





Occurs when changes are detected to the scrollbars position, extent, viewport size or visibility of the control.
Syntax
'Declaration
 
Public Event ScrollChanged As EventHandler(Of ImageViewerScrollChangedEventArgs)
'Usage
 
Dim instance As ImageViewer
Dim handler As EventHandler(Of ImageViewerScrollChangedEventArgs)
 
AddHandler instance.ScrollChanged, handler

            

            
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
Copy Code  
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(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);
}
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

See Also

Reference

ImageViewer Class
ImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.