←Select platform

ScrollOffsetChanged Event

Summary

Occurs when the value of ScrollOffset changes.

Syntax
C#
C++/CLI
public event EventHandler ScrollOffsetChanged 
public:  
   event EventHandler^ ScrollOffsetChanged 
Remarks

This event is raised if the value of the ScrollOffset property is changed by either a programmatic modification or user interaction.

Example
C#
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
 
public ImageViewerForm _form = new ImageViewerForm(); 
public ImageViewer _imageViewer; 
 
public void ImageViewerScrollModeExample() 
{ 
   // Get the ImageViewer control 
   _imageViewer = _form.ImageViewer; 
 
   // Load Image 
   using (var codecs = new RasterCodecs()) 
      _imageViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif")); 
 
   // Set Zoom Mode to None 
   _imageViewer.Zoom(ControlSizeMode.None, 1.2, _imageViewer.DefaultZoomOrigin); 
 
   // Hook to the ScrollOffset event that triggers when ScrollOffset value is changed 
   _imageViewer.ScrollOffsetChanged += (sender, e) => 
   { 
      Debug.WriteLine("ScrollOffset changed: (" + _imageViewer.ScrollOffset.X + ", " + _imageViewer.ScrollOffset.Y + ")"); 
   }; 
 
   // Set ScrollMode to hidden 
   if (_imageViewer.ScrollMode != ControlScrollMode.Hidden) 
   { 
      _imageViewer.ScrollMode = ControlScrollMode.Hidden; 
      _imageViewer.ScrollOffset = new LeadPoint(100, 100); // Offset the scroll 
      _imageViewer.RestrictScroll = false; 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Event Data
ParameterTypeDescription
senderobjectThe source of the event.
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.