Hi,
I want to know if is possible to auto refresh the current focused index when we scroll the ImageViewer by scroll or mouse wheel
Now the focused index will be changed when I click on the visible page
I tried on then PDF Editor Demo shipped with Vintasoft installation
Thank you
Force FocusedIndexChanged when scroll
Moderator: Alex
-
- Posts: 7
- Joined: Wed May 20, 2020 8:11 pm
Re: Force FocusedIndexChanged when scroll
Hi,
If you need to change the focused image in image viewer asynchronously, you need to use the ImageViewer.FocusedIndex property.
If you need to change the focused image in image viewer synchronously, you need to use the ImageViewer.SetFocusedIndexSync method.
Please try to change the focused image in image viewer and let me know if you will have any question or problem.
Best regards, Alexander
If you need to change the focused image in image viewer asynchronously, you need to use the ImageViewer.FocusedIndex property.
If you need to change the focused image in image viewer synchronously, you need to use the ImageViewer.SetFocusedIndexSync method.
Please try to change the focused image in image viewer and let me know if you will have any question or problem.
Best regards, Alexander
-
- Posts: 7
- Joined: Wed May 20, 2020 8:11 pm
Re: Force FocusedIndexChanged when scroll
Hi,
I added this code to ImageViewer Scroll and MouseWheel event and it works well
If you have a better solution let me know
Thanks
I added this code to ImageViewer Scroll and MouseWheel event and it works well
Code: Select all
private void UpdateFocusIndexWhenScroll()
{
var images = imageViewer1.GetVisibleImages();
if (images.Length > 0 && imageViewer1.FocusedIndex != images[0].SourceInfo.PageIndex)
{
imageViewer1.DisableAutoScrollToFocusedImage();
imageViewer1.FocusedIndex = images[0].SourceInfo.PageIndex;
imageViewer1.EnableAutoScrollToFocusedImage();
}
}
private void imageViewer1_Scroll(object sender, ScrollEventArgs e)
{
UpdateFocusIndexWhenScroll();
}
private void ImageViewer1_MouseWheel(object sender, MouseEventArgs e)
{
UpdateFocusIndexWhenScroll();
}
Thanks
Re: Force FocusedIndexChanged when scroll
Hi,
I think your code is optimal.
Best regards, Alexander
I think your code is optimal.
Best regards, Alexander