SetFocusedIndexSync(Int32) Method (ImageViewer)
This method sets the value of the FocusedIndex property and waits while new image will be loaded in the viewer.
This C#/VB.NET code shows how to start animation in ImageViewer if image viewer uses images from Images property.
''' <summary>
''' Shows animation in image viewer.
''' </summary>
''' <param name="viewer">An image viewer.</param>
''' <param name="delay">The animation delay in milliseconds.</param>
Private Sub ShowAnimation(viewer As Vintasoft.Imaging.UI.ImageViewer, delay As Integer)
' for each image in image collection of image viewer
For i As Integer = 0 To viewer.Images.Count - 1
' change image in image viewer
viewer.SetFocusedIndexSync(i)
' sleep for a while
System.Threading.Thread.Sleep(delay)
Next
End Sub
/// <summary>
/// Shows animation in image viewer.
/// </summary>
/// <param name="viewer">An image viewer.</param>
/// <param name="delay">The animation delay in milliseconds.</param>
private void ShowAnimation(Vintasoft.Imaging.UI.ImageViewer viewer, int delay)
{
// for each image in image collection of image viewer
for (int i = 0; i < viewer.Images.Count; i++)
{
// change image in image viewer
viewer.SetFocusedIndexSync(i);
// sleep for a while
System.Threading.Thread.Sleep(delay);
}
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5