LEADTOOLS WebForms and AJAX (Leadtools.Web assembly)
LEAD Technologies, Inc

GetThumbnailText Method

Example 





The 0-based index of the thumbnail element about which to obtain its text.
Gets the thumbnail text for a specific thumbnail element.
Syntax
public string GetThumbnailText( 
   int thumbIndex
)
'Declaration
 
Public Function GetThumbnailText( _
   ByVal thumbIndex As Integer _
) As String
'Usage
 
Dim instance As WebThumbnailViewer
Dim thumbIndex As Integer
Dim value As String
 
value = instance.GetThumbnailText(thumbIndex)
public string GetThumbnailText( 
   int thumbIndex
)
 function Leadtools.Web.Controls.WebThumbnailViewer.GetThumbnailText( 
   thumbIndex 
)
public:
String^ GetThumbnailText( 
   int thumbIndex
) 

Parameters

thumbIndex
The 0-based index of the thumbnail element about which to obtain its text.

Return Value

The thumbnail element text.
Example
 
Public Function WebThumbnailViewer_GetThumbnailImageByText(ByVal webThumbnailViewer As WebThumbnailViewer, ByVal targetThumbText As String) As RasterImage
   Dim image As RasterImage = Nothing
   Dim thumbImageUrl As String = String.Empty
   Dim pageIndex As Integer = 0
   If webThumbnailViewer.Count > 1 Then
      Dim thumbInfo As ThumbnailInfo


      For i As Integer = 0 To webThumbnailViewer.Count Step 1
         Dim currentThumbText As String = webThumbnailViewer.GetThumbnailText(i)

         If currentThumbText = targetThumbText Then
            thumbInfo = webThumbnailViewer.GetThumbnailInfo(i)

            thumbImageUrl = thumbInfo.Url
            If thumbInfo.CacheFileName <> String.Empty Then
               thumbImageUrl = thumbInfo.CacheFileName
            End If

            pageIndex = thumbInfo.Page
            Exit For
         End If
      Next i

      If thumbImageUrl <> String.Empty Then
         Using codecs As RasterCodecs = New RasterCodecs()
            Dim filePath As String = webThumbnailViewer.Page.MapPath(thumbImageUrl)

            image = codecs.Load(filePath, 0, CodecsLoadByteOrder.BgrOrGray, pageIndex, pageIndex)
         End Using
      End If
   End If
   Return image
End Function
public RasterImage WebThumbnailViewer_GetThumbnailImageByText(WebThumbnailViewer webThumbnailViewer, string targetThumbText)
{
   RasterImage image = null;
   string thumbImageUrl = string.Empty;
   int pageIndex = 0;
   if (webThumbnailViewer.Count > 1)
   {
      ThumbnailInfo thumbInfo;
      for (int i = 0; i < webThumbnailViewer.Count; i++)
      {
         string currentThumbText = webThumbnailViewer.GetThumbnailText(i);

         if (currentThumbText == targetThumbText)
         {
            thumbInfo = webThumbnailViewer.GetThumbnailInfo(i);

            thumbImageUrl = thumbInfo.Url;
            if (thumbInfo.CacheFileName != string.Empty)
               thumbImageUrl = thumbInfo.CacheFileName;

            pageIndex = thumbInfo.Page;
            break;
         }
      }

      if (thumbImageUrl != string.Empty)
      {
         using (RasterCodecs codecs = new RasterCodecs())
         {
            string filePath = webThumbnailViewer.Page.MapPath(thumbImageUrl);

            image = codecs.Load(filePath, 0, CodecsLoadByteOrder.BgrOrGray, pageIndex, pageIndex);
         }
      }
   }
   return image;
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

WebThumbnailViewer Class
WebThumbnailViewer Members
WebThumbnailViewer Client Class

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.