VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.UI Namespace / ImageViewer Class / SetFocusedIndexSync Method
New value of the FocusedIndex property.
Example



In This Topic
    SetFocusedIndexSync Method (ImageViewer)
    In This Topic
    Sets a new value of the FocusedIndex property synchronously.
    Syntax
    'Declaration
     
    Public Sub SetFocusedIndexSync( _
       ByVal newFocusedIndex As Integer _
    ) 
    public void SetFocusedIndexSync( 
       int newFocusedIndex
    )
    public: void SetFocusedIndexSync( 
       int newFocusedIndex
    ) 
    public:
    void SetFocusedIndexSync( 
       int 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 example 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: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also