TopIndex Property

Summary

Gets or sets the index of the first visible item in the control.

Syntax

C#
C++/CLI
C++
public int TopIndex { get; set; } 
[BrowsableAttribute(false)] 
public: 
property int TopIndex { 
   int get(); 
   void set (    int ); 
} 
public:  
   property Int32 TopIndex 
   { 
      Int32 get() 
      void set(Int32 value) 
   } 

Property Value

The index of the first visible item in the control.

Remarks

Initially, the item with the index position of zero (0) is at the top of the RasterImageList control. If the RasterImageList control contents are scrolled, a different item can be at the top of the control. You can use this property to determine which item is visible at the top of the RasterImageList control. To position a specific item in the visible region of the control, set its index to the TopIndex property.

Example

C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
 
public void RasterImageList_ScrollStyle(RasterImageList imageList) 
{ 
   // Clear out any items in the image list 
   imageList.Items.Clear(); 
 
   // Create 20 items 
   for (int i = 0; i < 20; i++) 
   { 
      // Load the image 
      int index = i + 1; 
      RasterImageListItem item = new RasterImageListItem(null, 1, "Item" + index.ToString()); 
 
      // Select every otehr item 
      if ((i % 2) == 0) 
         item.Selected = true; 
 
      // Add the item to the image list 
      imageList.Items.Add(item); 
   } 
 
   // Set vertical scrolling style 
   imageList.ScrollStyle = RasterImageListScrollStyle.Vertical; 
 
   // Scroll a couple of lines down 
   imageList.ScrollItems(2); 
 
   // Show the scroll parameters of the control 
   ShowScrollParameters(imageList); 
 
   // Switch to horizontal scrolling style 
   imageList.ScrollStyle = RasterImageListScrollStyle.Horizontal; 
 
   // Show the scroll parameters of the control 
   ShowScrollParameters(imageList); 
} 
 
 
private void ShowScrollParameters(RasterImageList imageList) 
{ 
   StringBuilder sb = new StringBuilder(); 
   sb.AppendFormat("Full Visible Rows: {0}{1}", imageList.FullVisibleRows, Environment.NewLine); 
   sb.AppendFormat("Visible Rows: {0}{1}", imageList.VisibleRows, Environment.NewLine); 
   sb.AppendFormat("Full Visible Columns: {0}{1}", imageList.FullVisibleColumns, Environment.NewLine); 
   sb.AppendFormat("Visible Columns:{0}{1}", imageList.VisibleColumns, Environment.NewLine); 
   sb.AppendFormat("TotalRows: {0}{1}", imageList.TotalRows, Environment.NewLine); 
   sb.AppendFormat("TotalColumns: {0}{1}", imageList.TotalColumns, Environment.NewLine); 
   sb.AppendFormat("TopIndex: {0}{1}", imageList.TopIndex, Environment.NewLine); 
   MessageBox.Show(sb.ToString()); 
} 

Requirements

Target Platforms

See Also

Reference

RasterImageList Class

RasterImageList Members

Help Version 22.0.2023.2.9
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.WinForms Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.