Leadtools.WinForms Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Page Property
See Also  Example
Leadtools.WinForms Namespace > RasterImageListItem Class : Page Property



Image page number to display.

Syntax

Visual Basic (Declaration) 
Public Property Page As Integer
Visual Basic (Usage)Copy Code
Dim instance As RasterImageListItem
Dim value As Integer
 
instance.Page = value
 
value = instance.Page
C# 
public int Page {get; set;}
C++/CLI 
public:
property int Page {
   int get();
   void set (int value);
}

Return Value

The 1-based page number index in RasterImageListItem.Image to display. The efault value is 1.

Example

This example will create and populate a RasterImageList control with thumbnail of the pages in a multi-page image file.

Visual BasicCopy Code
Public Sub RasterImageListItem_Page(ByVal imageList As RasterImageList)
   ' Initialize the RasterCodecs class
   RasterCodecs.Startup()
   Dim codecs As RasterCodecs = New RasterCodecs()
   ' Clear existing items
   imageList.Items.Clear()

   ' Load a multi-page file
      Dim fileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "eye.gif"
   Dim image As RasterImage = codecs.Load(fileName)

   ' Create the items (1 for each page)
   Dim page As Integer = 1
   Do While page <= image.PageCount
      Dim item As RasterImageListItem = New RasterImageListItem()

      item.Image = image ' Use the same image for all items
      item.Page = page ' But with a different page number
      item.Text = "Page " & page.ToString()

      ' Add the item to the image list
      imageList.Items.Add(item)
      page += 1
   Loop

   RasterCodecs.Shutdown()

End Sub
C#Copy Code
public void RasterImageListItem_Page(RasterImageList imageList) 

   // Initialize the RasterCodecs class 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   // Clear existing items 
   imageList.Items.Clear(); 
 
   // Load a multi-page file 
   string fileName = LeadtoolsExamples.Common.ImagesPath.Path + "eye.gif"; 
   RasterImage image = codecs.Load(fileName); 
 
   // Create the items (1 for each page) 
   for (int page = 1; page <= image.PageCount; page++) 
   { 
      RasterImageListItem item = new RasterImageListItem(); 
 
      item.Image = image;  // Use the same image for all items 
      item.Page = page;  // But with a different page number 
      item.Text = "Page " + page.ToString(); 
 
      // Add the item to the image list 
      imageList.Items.Add(item); 
   } 
 
   RasterCodecs.Shutdown(); 
 
}

Remarks

Set up the RasterImageList control to an individual page of a multi-page file in each item. To do that, simply set the RasterImageListItem.Image property of each item into the multi-page image, then set the Page property to the desired page.

The value of RasterImage.Page is not used to control the page number of the item to be viewed in this item. Instead, use the Page property. This allows the same RasterImage object to be used multiple items while setting the Page property to different values.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also