Represents an item in a ImageList control containing a LEADTOOLS Leadtools.RasterImage.
public class RasterImageListItem : ImageListItem Public Class RasterImageListItemInherits Leadtools.Windows.Controls.ImageListItemImplements 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 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:
Adding items with a LEADTOOLS Leadtools.RasterImage object using the Image property.
In WPF/Silverlight, an image that is displayed must be an System.Windows.Media.ImageSource or one of its derived classes, the RasterImageListItem class keeps the ImageListItem.Source property synchronized with RasterImageListItem.Image, any changes that occur to the LEADTOOLS Leadtools.RasterImage is reflected in the Source property and a standard System.Windows.FrameworkPropertyMetadata.AffectsMeasure or System.Windows.FrameworkPropertyMetadata.AffectsRender is performed. Also, this control will subscribe to the RasterImage.Changed to monitor any changes that may occur to the image (through image processing for example) and reflect these changes to the Source property.
If the Source property is changed, the RasterImageListItem must be informed so it can reflect the changes into the Image object. The UpdateImageFromSource can be used to perform this task.
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 windowWidth = 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 itemsstring 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 itemif (i == 0)item.IsSelected = true;// Add the item to the image listimageList.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.ControlsImports Leadtools.CodecsPrivate Class MyWindow2 : Inherits WindowPublic imageList As ListBoxPublic Sub New(ByVal title As String)title = title' Set the size of the windowWidth = 400Height = 200' Create a new ImageList control.imageList = New ListBox()imageList.Width = Double.NaNimageList.Height = Double.NaNimageList.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 itemsDim imagesPath As String = LEAD_VARS.ImagesDirTryUsing codecs As RasterCodecs = New RasterCodecs()For i As Integer = 0 To 2Dim index As Integer = i + 1Dim imageFileName As String = Path.Combine(imagesPath, "ImageProcessingDemo\Image" & index.ToString() & ".jpg")Dim item As RasterImageListItem = New RasterImageListItem()item.Uri = New Uri(imageFileName)item.Text = imageFileNameitem.ShowText = Trueitem.Image = codecs.Load(imageFileName)item.ImageSize = New Size(120, 120)item.Width = 150item.Height = 150item.SelectedBackground = Brushes.Whiteitem.SelectedForeground = Brushes.Blue' Select the first itemIf i = 0 Thenitem.IsSelected = TrueEnd If' Add the item to the image listimageList.Items.Add(item)Next iEnd UsingCatch ex As ExceptionMessageBox.Show(ex.Message)FinallyEnd Try' Add the ImageList to the Window.Content = imageListEnd SubEnd ClassPublic Sub ImageListItem_RasterImageListItem(ByVal title As String)Dim window As MyWindow1 = New MyWindow1(title)window.ShowDialog()End SubPublic NotInheritable Class LEAD_VARSPublic 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 windowWidth = 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 itemsstring 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 itemif (i == 0)item.IsSelected = true;// Add the item to the image listimageList.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.ControlsImports Leadtools.CodecsPrivate Class MyWindow2 : Inherits ChildWindowPublic imageList As ListBoxPublic Sub New(ByVal title As String)title = title' Set the size of the windowWidth = 400Height = 200' Create a new ImageList control.imageList = New ListBox()imageList.Width = Double.NaNimageList.Height = Double.NaNimageList.Background = New RadialGradientBrush(Colors.DarkGray, Colors.LightGray)imageList.BorderThickness = New Thickness(5, 5, 5, 5)' Create three itemsDim imagesPath As String = LeadtoolsExamples.Common.ImagesPath.PathTryDim codecs As RasterCodecs = New RasterCodecs()For i As Integer = 0 To 2Dim index As Integer = i + 1Dim imageFileName As String = imagesPath & "Image" & index.ToString() & ".jpg"Dim item As RasterImageListItem = New RasterImageListItem()item.Uri = New Uri(imageFileName)item.Text = imageFileNameitem.ShowText = Trueitem.Image = codecs.Load(imageFileName)item.ImageSize = New Size(120, 120)item.Width = 150item.Height = 150item.SelectedBackground = New SolidColorBrush(Colors.White)item.SelectedForeground = New SolidColorBrush(Colors.Blue)' Select the first itemIf i = 0 Thenitem.IsSelected = TrueEnd If' Add the item to the image listimageList.Items.Add(item)Next iCatch ex As ExceptionMessageBox.Show(ex.Message)FinallyEnd Try' Add the ImageList to the Window.Content = imageListEnd SubEnd ClassPublic Sub ImageListItem_RasterImageListItem(ByVal title As String)Dim window As MyWindow1 = New MyWindow1(title)window.Show()End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
