VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.UI Namespace / ImageViewer Class / SetFocusedIndexSync(Int32) Method
Syntax Remarks Example Requirements SeeAlso
In This Topic
SetFocusedIndexSync(Int32) Method (ImageViewer)
In This Topic
Sets a new value of the FocusedIndex property synchronously.
Syntax
'Declaration

Public Sub SetFocusedIndexSync( _
ByVal newFocusedIndex
New value of the FocusedIndex property.
As System.Int32 _
)
public void SetFocusedIndexSync(
System.Int32 newFocusedIndex
)

Parameters

newFocusedIndex
New value of the FocusedIndex property.
Remarks

This method sets the value of the FocusedIndex property and waits while new image will be loaded in the viewer.

Example

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);
    }
}

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also