VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
In This Topic
    How to programmatically scroll WinForms viewer to the focused image?
    In This Topic
    Here is C# code that shows how to programmatically scroll ImageViewer to the focused image:
    // disable the autoscrolling to the focused image
    imageViewer1.DisableAutoScrollToFocusedImage();
    // move focus to the next image
    imageViewer1.FocusedIndex = imageViewer1.FocusedIndex + 1;
    // enable the autoscrolling to the focused image
    imageViewer1.EnableAutoScrollToFocusedImage();
    
    // get focused image
    VintasoftImage image = imageViewer1.Images[imageViewer1.FocusedIndex];
    // get viewer state of focused image
    ImageViewerState viewerStateForImage = imageViewer1.GetViewerState(image);
    // get image rectangle in viewer space
    System.Drawing.RectangleF imageRectInViewer = viewerStateForImage.ImageRectInViewer;
    // scroll viewer to the image rectangle
    imageViewer1.ScrollToRect(imageRectInViewer);