Code samples

Code samples for VintaSoft Imaging .NET SDK. Here you can request a code sample.

Board index < VintaSoft Imaging < VintaSoft Imaging .NET SDK and Plug-ins Discussions < Code samples

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

WinForms: Scroll WinForms viewer to the focused image programmatically.



WinForms: Scroll WinForms viewer to the focused image programmatically.

Post by Alex »

This topic contains C# code snippet that allows to scroll WinForms viewer to the focused image programmatically:
// 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);


Page 1 from 1: 1