ThumbnailXpress 6 for .NET - User Guide > How To > Navigate Thumbnails > Navigate Programmatically |
Scrolling the thumbnail control can be controlled programmatically by calling the ScrollItems method to specify the scrolling action and magnitude. The view changes to reflect the requested scrolling. Alternatively, call EnsureVisible to programmatically scroll the thumbnail control until a specified thumbnail is in view.
C# |
Copy Code
|
---|---|
// Scroll forward one page. The second parameter is not used. ThumbnailXpress1.ScrollItems(ScrollItemsType.LargeIncrease, 0); // Scroll backward one row or column. The second parameter is not used. ThumbnailXpress1.ScrollItems(ScrollItemsType.SmallDecrease, 0); // Scroll to the ninth thumbnail item. ThumbnailXpress1.ScrollItems(ScrollItemsType.ItemIndex, 8); // If the scroll direction is vertical, this will scroll to the third row. // If the scroll direction is horizontal, this will scroll to the third column. ThumbnailXpress1.ScrollItems(ScrollItemsType.ThumbPosition, 2); // Scroll so that the first thumbnail item is displayed. ThumbnailXpress1.EnsureVisible(0); |
Individual thumbnails can be selected programmatically by calling the Add method of the SelectedThumbnailItemCollection and specifying the thumbnail item to select. The SelectedThumbnailItemCollection reflects the number of thumbnails that have been selected, both programmatically as well as by end-user.
C# |
Copy Code
|
---|---|
// Select the first thumbnail item. ThumbnailXpress1.SelectedItems.Add(ThumbnailXpress1.Items[0]); // Select the second thumbnail item. ThumbnailXpress1.SelectedItems.Add(ThumbnailXpress1.Items[1]); // Clear the selected thumbnail items so that no thumbnail items are selected. ThumbnailXpress1.SelectedItems.Clear(); |