←Select platform

RasterImageListItem Class

Summary

Represents an item in a ImageList control containing a LEADTOOLS Leadtools.RasterImage.

Syntax

C#
VB
C++
public class RasterImageListItem : ImageListItem 
  
Public Class RasterImageListItem  
   Inherits Leadtools.Windows.Controls.ImageListItem 
   Implements Leadtools.Windows.Controls.IImageListItem, System.ComponentModel.ISupportInitialize, System.Windows.IFrameworkInputElement, System.Windows.IInputElement, System.Windows.Markup.IAddChild, System.Windows.Markup.IQueryAmbient, System.Windows.Media.Animation.IAnimatable  
public ref class RasterImageListItem : public Leadtools.Windows.Controls.ImageListItem, Leadtools.Windows.Controls.IImageListItem, System.ComponentModel.ISupportInitialize, System.Windows.IFrameworkInputElement, System.Windows.IInputElement, System.Windows.Markup.IAddChild, System.Windows.Markup.IQueryAmbient, System.Windows.Media.Animation.IAnimatable   

Remarks

The RasterImageListItem class derives from ImageListItem and adds functionality to display a LEADTOOLS Leadtools.RasterImage object in the WPF/Silverlight ImageList control. To display a System.Windows.Media.ImageSource or one of its derived classes, use the ImageListItem class.

In addition to all the features supported by the ImageListItem class, RasterImageListItem adds the following:

Example

C#
VB
Silverlight C#
Silverlight VB
using Leadtools.Help; 
using Leadtools.Windows.Controls; 
using Leadtools.Codecs; 
 
class MyWindow2 : Window 
{ 
   public ImageList imageList; 
   public MyWindow2(string title) 
   { 
      Title = title; 
 
      // Set the size of the window 
      Width = 400; 
      Height = 200; 
 
      // Create a new ImageList control. 
      imageList = new ImageList(); 
      imageList.Width = Double.NaN; 
      imageList.Height = Double.NaN; 
 
      imageList.Items.SortDescriptions.Clear(); 
      imageList.Background = new RadialGradientBrush(Colors.DarkGray, Colors.LightGray); 
      imageList.Items.SortDescriptions.Add(new SortDescription("Text", ListSortDirection.Ascending)); 
 
      imageList.BorderThickness = new Thickness(5, 5, 5, 5); 
 
 
      // Create three items 
      string imagesPath = LEAD_VARS.ImagesDir; 
      try 
      { 
 
         using (RasterCodecs codecs = new RasterCodecs()) 
         { 
            for (int i = 0; i < 3; i++) 
            { 
               int index = i + 1; 
               string imageFileName = Path.Combine(imagesPath, @"ImageProcessingDemo\Image" + index.ToString() + ".jpg"); 
 
               RasterImageListItem item = new RasterImageListItem(); 
               item.Uri = new Uri(imageFileName); 
               item.Text = imageFileName; 
               item.ShowText = true; 
 
               item.Image = codecs.Load(imageFileName); 
               item.ImageSize = new Size(120, 120); 
               item.Width = 150; 
               item.Height = 150; 
               item.SelectedBackground = Brushes.White; 
               item.SelectedForeground = Brushes.Blue; 
 
               // Select the first item 
               if (i == 0) 
                  item.IsSelected = true; 
 
               // Add the item to the image list 
               imageList.Items.Add(item); 
            } 
         } 
      } 
      catch (Exception ex) 
      { 
         MessageBox.Show(ex.Message); 
      } 
      finally 
      { 
      } 
 
      // Add the ImageList to the Window. 
      Content = imageList; 
   } 
} 
 
public void ImageListItem_RasterImageListItem(string title) 
{ 
   MyWindow1 window = new MyWindow1(title); 
   window.ShowDialog(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 
Imports Leadtools.Windows.Controls 
Imports Leadtools.Codecs 
 
Private Class MyWindow2 : Inherits Window 
   Public imageList As ListBox 
   Public Sub New(ByVal title As String) 
      title = title 
 
      ' Set the size of the window 
      Width = 400 
      Height = 200 
 
      ' Create a new ImageList control. 
      imageList = New ListBox() 
      imageList.Width = Double.NaN 
      imageList.Height = Double.NaN 
 
      imageList.Items.SortDescriptions.Clear() 
      imageList.Background = New RadialGradientBrush(Colors.DarkGray, Colors.LightGray) 
      imageList.Items.SortDescriptions.Add(New SortDescription("Text", ListSortDirection.Ascending)) 
 
      imageList.BorderThickness = New Thickness(5, 5, 5, 5) 
 
 
      ' Create three items 
      Dim imagesPath As String = LEAD_VARS.ImagesDir 
      Try 
 
         Using codecs As RasterCodecs = New RasterCodecs() 
            For i As Integer = 0 To 2 
               Dim index As Integer = i + 1 
               Dim imageFileName As String = Path.Combine(imagesPath, "ImageProcessingDemo\Image" & index.ToString() & ".jpg") 
 
               Dim item As RasterImageListItem = New RasterImageListItem() 
               item.Uri = New Uri(imageFileName) 
               item.Text = imageFileName 
               item.ShowText = True 
 
               item.Image = codecs.Load(imageFileName) 
               item.ImageSize = New Size(120, 120) 
               item.Width = 150 
               item.Height = 150 
               item.SelectedBackground = Brushes.White 
               item.SelectedForeground = Brushes.Blue 
 
               ' Select the first item 
               If i = 0 Then 
                  item.IsSelected = True 
               End If 
 
               ' Add the item to the image list 
               imageList.Items.Add(item) 
            Next i 
         End Using 
      Catch ex As Exception 
         MessageBox.Show(ex.Message) 
      Finally 
      End Try 
 
      ' Add the ImageList to the Window. 
      Content = imageList 
   End Sub 
End Class 
 
Public Sub ImageListItem_RasterImageListItem(ByVal title As String) 
   Dim window As MyWindow1 = New MyWindow1(title) 
   window.ShowDialog() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 
using Leadtools.Help; 
using Leadtools.Windows.Controls; 
using Leadtools.Codecs; 
 
class MyWindow2 : ChildWindow 
{ 
   public ListBox imageList; 
   public MyWindow2(string title) 
   { 
      Title = title; 
 
      // Set the size of the window 
      Width = 400; 
      Height = 200; 
 
      // Create a new ImageList control. 
      imageList = new ListBox(); 
      imageList.Width = Double.NaN; 
      imageList.Height = Double.NaN; 
 
      imageList.Background = new RadialGradientBrush(Colors.DarkGray, Colors.LightGray); 
      imageList.BorderThickness = new Thickness(5, 5, 5, 5); 
 
 
      // Create three items 
      string imagesPath = LeadtoolsExamples.Common.ImagesPath.Path; 
      try 
      { 
         RasterCodecs codecs = new RasterCodecs(); 
         for (int i = 0; i < 3; i++) 
         { 
            int index = i + 1; 
            string imageFileName = imagesPath + "Image" + index.ToString() + ".jpg"; 
 
            RasterImageListItem item = new RasterImageListItem(); 
            item.Uri = new Uri(imageFileName); 
            item.Text = imageFileName; 
            item.ShowText = true; 
 
            item.Image = codecs.Load(imageFileName); 
            item.ImageSize = new Size(120, 120); 
            item.Width = 150; 
            item.Height = 150; 
            item.SelectedBackground = new SolidColorBrush(Colors.White); 
            item.SelectedForeground = new SolidColorBrush(Colors.Blue); 
 
            // Select the first item 
            if (i == 0) 
               item.IsSelected = true; 
 
            // Add the item to the image list 
            imageList.Items.Add(item); 
         } 
      } 
      catch (Exception ex) 
      { 
         MessageBox.Show(ex.Message); 
      } 
      finally 
      { 
      } 
 
      // Add the ImageList to the Window. 
      Content = imageList; 
   } 
} 
 
public void ImageListItem_RasterImageListItem(string title) 
{ 
   MyWindow1 window = new MyWindow1(title); 
   window.Show(); 
} 
Imports Leadtools.Windows.Controls 
Imports Leadtools.Codecs 
 
Private Class MyWindow2 : Inherits ChildWindow 
   Public imageList As ListBox 
   Public Sub New(ByVal title As String) 
      title = title 
 
      ' Set the size of the window 
      Width = 400 
      Height = 200 
 
      ' Create a new ImageList control. 
      imageList = New ListBox() 
      imageList.Width = Double.NaN 
      imageList.Height = Double.NaN 
 
      imageList.Background = New RadialGradientBrush(Colors.DarkGray, Colors.LightGray) 
      imageList.BorderThickness = New Thickness(5, 5, 5, 5) 
 
 
      ' Create three items 
      Dim imagesPath As String = LeadtoolsExamples.Common.ImagesPath.Path 
      Try 
         Dim codecs As RasterCodecs = New RasterCodecs() 
         For i As Integer = 0 To 2 
            Dim index As Integer = i + 1 
            Dim imageFileName As String = imagesPath & "Image" & index.ToString() & ".jpg" 
 
            Dim item As RasterImageListItem = New RasterImageListItem() 
            item.Uri = New Uri(imageFileName) 
            item.Text = imageFileName 
            item.ShowText = True 
 
            item.Image = codecs.Load(imageFileName) 
            item.ImageSize = New Size(120, 120) 
            item.Width = 150 
            item.Height = 150 
            item.SelectedBackground = New SolidColorBrush(Colors.White) 
            item.SelectedForeground = New SolidColorBrush(Colors.Blue) 
 
            ' Select the first item 
            If i = 0 Then 
               item.IsSelected = True 
            End If 
 
            ' Add the item to the image list 
            imageList.Items.Add(item) 
         Next i 
      Catch ex As Exception 
         MessageBox.Show(ex.Message) 
      Finally 
      End Try 
 
      ' Add the ImageList to the Window. 
      Content = imageList 
   End Sub 
End Class 
 
Public Sub ImageListItem_RasterImageListItem(ByVal title As String) 
   Dim window As MyWindow1 = New MyWindow1(title) 
   window.Show() 
End Sub 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Windows.Controls Assembly