(Leadtools.Controls)

ScrollOffset Property

Show in webframe
Example 





Gets or sets the scroll offset value.
Syntax
public Point ScrollOffset {get; set;}
Public Property ScrollOffset As Point
public Point ScrollOffset {get; set;}
@property (nonatomic) CGPoint scrollOffset;
public Point getScrollOffset()
public void setScrollOffset(Point point)
            
 
get_ScrollOffset();
set_ScrollOffset(value);
Object.defineProperty('ScrollOffset');

Property Value

The current scroll offset value. The default value is 0,0.
Remarks

Changing the value of this property will fire the PropertyChanged, ScrollChanged and TransformChanged events.

When the value of ScrollMode is ImageViewerScrollMode.Auto, then the value of ScrollOffset contains the current scrollbars offset. When the user clicks and drags on the scrollbars, the value of ScrollOffset (and the scrollbars thumbs) changes accordingly. The minimum value allowed is 0,0 (top-left) and the the maximum value allowed is stored in ScrollRange (setting ScrollOffset to ScrollRange will cause the viewer to scroll the image to the bottom-right corner. You can manually pan the image by setting a value in ScrollOffset or calling ScrollBy.

When the value of ScrollMode is ImageViewerScrollMode.Hidden, then the value of ScrollOffset contains the virtual scroll (pan) offset, you can pan the image by changing the value of ScrollOffset or calling ScrollBy. If the value of RestrictHiddenScrollMode is true, then the minimum and maximum scroll values are the same as the case above. If the value of RestrictHiddenScrollMode is false, then there is no minimum and maximum scroll ranges and any value is allowed for ScrollOffset. ScrollRange will still be the value to use if you want to either scroll the image to top-left or right-bottom.

When the value of ScrollMode is ImageViewerScrollMode.Disabled changing the value of ScrollOffset or calling ScrollBy will be ignored.

Example
Copy Code  
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;

[TestMethod]
public void ScrollOffsetExample()
{
   bool scrollChangedHooked = false;
   // Set DefaultInteractiveMode property to ImageViewerPanZoomInteractiveMode to see the example effect
   ImageViewerPanZoomInteractiveMode panZoomMode = new ImageViewerPanZoomInteractiveMode();
   _viewer.DefaultInteractiveMode = panZoomMode;
   // Subscribe to the PropertyChanged event

   // Get the scroll current range
   Size scrollRange = _viewer.ScrollRange;

   if(!scrollChangedHooked)
   {
      // First click, hook to the event
      scrollChangedHooked = true;
      _viewer.ScrollChanged += _viewer_ScrollChanged;
   }
   else
   {
      // Other clicks, scroll to bottom-right
      _viewer.ScrollOffset = new Point(scrollRange.Width, scrollRange.Height);
   }
}

void _viewer_ScrollChanged(object sender, EventArgs e)
{
   // Show the scroll offset and range
   Point scrollOffset = _viewer.ScrollOffset;
   _infoLabel.Text =
      "Current scroll offset: " + scrollOffset.X + ", " + scrollOffset.Y +
      ". Scroll range: " + _viewer.ScrollRange.Width + ", " + _viewer.ScrollRange.Height +
      ". Click Example again to scroll to bottom-right";
}
Requirements

Target Platforms

See Also

Reference

ImageViewer Class
ImageViewer Members

 

 


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